aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/docker/Dockerfile9
-rw-r--r--src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java16
-rw-r--r--src/main/java/org/onap/clamp/clds/config/spring/SSLConfiguration.java56
-rw-r--r--src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java22
-rw-r--r--src/main/java/org/onap/clamp/clds/model/properties/Holmes.java16
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParser.java40
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java2
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstaller.java1
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java2
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/MicroService.java18
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsService.java7
-rw-r--r--src/main/java/org/onap/clamp/clds/util/drawing/SvgFacade.java2
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopCsarInstaller.java (renamed from src/main/java/org/onap/clamp/loop/CsarInstallerImpl.java)57
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopOperation.java251
-rw-r--r--src/main/java/org/onap/clamp/loop/log/LoopLog.java2
-rw-r--r--src/main/java/org/onap/clamp/policy/Policy.java4
-rw-r--r--src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java18
-rw-r--r--src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html33
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js2
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js212
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/propertyController.js4
-rw-r--r--src/main/resources/application-noaaf.properties16
-rw-r--r--src/main/resources/application.properties21
-rw-r--r--src/main/resources/clds/camel/rest/clamp-api-v2.xml368
-rw-r--r--src/main/resources/clds/camel/routes/flexible-flow.xml823
25 files changed, 1229 insertions, 773 deletions
diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile
index f2c7edd8e..c47d6229e 100644
--- a/src/main/docker/Dockerfile
+++ b/src/main/docker/Dockerfile
@@ -20,6 +20,15 @@ RUN chmod 700 /opt/clamp/app.jar
RUN chown -R clamp:onap /opt/clamp
+RUN apk add fontconfig
+RUN apk add ttf-dejavu
+
+RUN ln -s /usr/lib/libfontconfig.so.1 /usr/lib/libfontconfig.so && \
+ ln -s /lib/libuuid.so.1 /usr/lib/libuuid.so.1 && \
+ ln -s /lib/libc.musl-x86_64.so.1 /usr/lib/libc.musl-x86_64.so.1
+
+ENV LD_LIBRARY_PATH /usr/lib
+
USER clamp
WORKDIR /opt/clamp/
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Xms256m", "-Xmx1g", "-jar" ,"./app.jar"]
diff --git a/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java
index 92b0272a9..bee0d4c05 100644
--- a/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java
@@ -39,23 +39,27 @@ import org.onap.clamp.clds.exception.sdc.controller.SdcControllerException;
import org.onap.clamp.clds.sdc.controller.SdcSingleController;
import org.onap.clamp.clds.sdc.controller.SdcSingleControllerStatus;
import org.onap.clamp.clds.sdc.controller.installer.CsarInstaller;
-import org.onap.clamp.clds.sdc.controller.installer.CsarInstallerImpl;
-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.clds")
@Profile("clamp-sdc-controller")
public class CldsSdcControllerConfiguration {
private static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsSdcControllerConfiguration.class);
private List<SdcSingleController> sdcControllersList = new ArrayList<>();
- @Autowired
- private ClampProperties clampProp;
- @Autowired
- protected CsarInstaller csarInstaller;
+ private final ClampProperties clampProp;
+ private final CsarInstaller csarInstaller;
+
+ public CldsSdcControllerConfiguration(ClampProperties clampProp, @Qualifier("oldModelInstaller") CsarInstaller csarInstaller) {
+ this.clampProp = clampProp;
+ this.csarInstaller = csarInstaller;
+ }
/**
* Loads SDC controllers configuration.
diff --git a/src/main/java/org/onap/clamp/clds/config/spring/SSLConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/SSLConfiguration.java
new file mode 100644
index 000000000..ac5849b80
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/config/spring/SSLConfiguration.java
@@ -0,0 +1,56 @@
+/*-
+ * ============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.clds.config.spring;
+
+import java.net.URL;
+
+import javax.annotation.PostConstruct;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+
+@Configuration
+public class SSLConfiguration {
+ @Autowired
+ private Environment env;
+
+ @PostConstruct
+ private void configureSSL() {
+ if (env.getProperty("server.ssl.trust-store") != null) {
+ URL storeResource = SSLConfiguration.class
+ .getResource(env.getProperty("server.ssl.trust-store").replaceAll("classpath:", ""));
+ System.setProperty("javax.net.ssl.trustStore", storeResource.getPath());
+ System.setProperty("javax.net.ssl.trustStorePassword", env.getProperty("server.ssl.trust-store-password"));
+ System.setProperty("javax.net.ssl.trustStoreType", env.getProperty("server.ssl.key-store-type"));
+
+ storeResource = SSLConfiguration.class
+ .getResource(env.getProperty("server.ssl.key-store").replaceAll("classpath:", ""));
+ System.setProperty("javax.net.ssl.keyStore", storeResource.getPath());
+ System.setProperty("javax.net.ssl.keyStorePassword", env.getProperty("server.ssl.key-store-password"));
+ System.setProperty("javax.net.ssl.keyStoreType", env.getProperty("server.ssl.key-store-type"));
+ }
+ }
+} \ No newline at end of file
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 55b90cc52..8b8ee932b 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
@@ -25,36 +25,39 @@ package org.onap.clamp.clds.config.spring;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-
import java.util.ArrayList;
import java.util.List;
-
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
-
import org.onap.clamp.clds.config.ClampProperties;
import org.onap.clamp.clds.config.sdc.SdcControllersConfiguration;
import org.onap.clamp.clds.exception.sdc.controller.SdcControllerException;
import org.onap.clamp.clds.sdc.controller.SdcSingleController;
import org.onap.clamp.clds.sdc.controller.SdcSingleControllerStatus;
import org.onap.clamp.clds.sdc.controller.installer.CsarInstaller;
-import org.onap.clamp.loop.CsarInstallerImpl;
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")
public class SdcControllerConfiguration {
private static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcControllerConfiguration.class);
private List<SdcSingleController> sdcControllersList = new ArrayList<>();
+ private final ClampProperties clampProp;
+ private final CsarInstaller csarInstaller;
+
@Autowired
- private ClampProperties clampProp;
- @Autowired
- protected CsarInstaller csarInstaller;
+ public SdcControllerConfiguration(ClampProperties clampProp, @Qualifier("loopInstaller") CsarInstaller csarInstaller) {
+ this.clampProp = clampProp;
+ this.csarInstaller = csarInstaller;
+ }
/**
* Loads SDC controller configuration.
@@ -101,11 +104,6 @@ public class SdcControllerConfiguration {
});
}
- @Bean(name = "csarInstaller")
- public CsarInstaller getCsarInstaller() {
- return new CsarInstallerImpl();
- }
-
@Bean(name = "sdcControllersConfiguration")
public SdcControllersConfiguration getSdcControllersConfiguration() {
return new SdcControllersConfiguration();
diff --git a/src/main/java/org/onap/clamp/clds/model/properties/Holmes.java b/src/main/java/org/onap/clamp/clds/model/properties/Holmes.java
index a93b09cfa..a56c57d19 100644
--- a/src/main/java/org/onap/clamp/clds/model/properties/Holmes.java
+++ b/src/main/java/org/onap/clamp/clds/model/properties/Holmes.java
@@ -26,11 +26,11 @@
package org.onap.clamp.clds.model.properties;
import com.google.gson.JsonObject;
+
import org.onap.clamp.clds.util.JsonUtils;
/**
- * Parse Holmes bpmn parameters json properties.
- * Example json:
+ * Parse Holmes bpmn parameters json properties. Example json:
* [{"name":"correlationalLogic","value":"vcwx"},{"name":"configPolicyName","value":"cccc"}]
*/
public class Holmes extends AbstractModelElement {
@@ -43,14 +43,18 @@ public class Holmes extends AbstractModelElement {
/**
* Default constructor for Holmes Element.
*
- * @param modelBpmn The model bpmn
- * @param modelJson The model json
+ * @param modelBpmn
+ * The model bpmn
+ * @param modelJson
+ * The model json
*/
public Holmes(ModelBpmn modelBpmn, JsonObject modelJson) {
super(TYPE_HOLMES, modelBpmn, modelJson);
- correlationLogic = JsonUtils.getStringValueByName(modelElementJsonNode, "correlationalLogic");
- configPolicyName = JsonUtils.getStringValueByName(modelElementJsonNode, "configPolicyName");
+ if (modelElementJsonNode != null) {
+ correlationLogic = JsonUtils.getStringValueByName(modelElementJsonNode, "correlationalLogic");
+ configPolicyName = JsonUtils.getStringValueByName(modelElementJsonNode, "configPolicyName");
+ }
}
public static final String getType() {
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 809904f22..aca2ed01d 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
@@ -29,6 +29,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+import java.util.AbstractMap;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -61,12 +62,12 @@ public class BlueprintParser {
public Set<MicroService> getMicroServices(String blueprintString) {
Set<MicroService> microServices = new HashSet<>();
JsonObject jsonObject = BlueprintParser.convertToJson(blueprintString);
- JsonObject results = jsonObject.get(NODE_TEMPLATES).getAsJsonObject();
+ JsonObject nodeTemplateList = jsonObject.get(NODE_TEMPLATES).getAsJsonObject();
- for (Entry<String, JsonElement> entry : results.entrySet()) {
+ for (Entry<String, JsonElement> entry : nodeTemplateList.entrySet()) {
JsonObject nodeTemplate = entry.getValue().getAsJsonObject();
if (nodeTemplate.get(TYPE).getAsString().contains(DCAE_NODES)) {
- MicroService microService = getNodeRepresentation(entry);
+ MicroService microService = getNodeRepresentation(entry, nodeTemplateList);
microServices.add(microService);
}
}
@@ -89,7 +90,7 @@ public class BlueprintParser {
}
String msName = theBiggestMicroServiceKey.toLowerCase().contains(HOLMES_PREFIX) ? HOLMES : TCA;
return Collections
- .singletonList(new MicroService(msName, "onap.policies.monitoring.cdap.tca.hi.lo.app", "", "", ""));
+ .singletonList(new MicroService(msName, "onap.policies.monitoring.cdap.tca.hi.lo.app", "", ""));
}
String getName(Entry<String, JsonElement> entry) {
@@ -118,8 +119,22 @@ public class BlueprintParser {
return "";
}
- String getModelType(Entry<String, JsonElement> entry) {
+ String findModelTypeInTargetArray(JsonArray jsonArray, JsonObject nodeTemplateList) {
+ 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);
+ if (!modelType.isEmpty()) {
+ return modelType;
+ }
+ }
+ return "";
+ }
+
+ String getModelType(Entry<String, JsonElement> entry, JsonObject nodeTemplateList) {
JsonObject ob = entry.getValue().getAsJsonObject();
+ // Search first in this node template
if (ob.has(PROPERTIES)) {
JsonObject properties = ob.get(PROPERTIES).getAsJsonObject();
if (properties.has(POLICYID)) {
@@ -129,19 +144,18 @@ public class BlueprintParser {
}
}
}
+ // Then it's may be a relationship
+ if (ob.has(RELATIONSHIPS)) {
+ return findModelTypeInTargetArray(ob.get(RELATIONSHIPS).getAsJsonArray(), nodeTemplateList);
+ }
return "";
}
- String getBlueprintName(Entry<String, JsonElement> entry) {
- return entry.getKey();
- }
-
- MicroService getNodeRepresentation(Entry<String, JsonElement> entry) {
+ MicroService getNodeRepresentation(Entry<String, JsonElement> entry, JsonObject nodeTemplateList) {
String name = getName(entry);
String getInputFrom = getInput(entry);
- String modelType = getModelType(entry);
- String blueprintName = getBlueprintName(entry);
- return new MicroService(name, modelType, getInputFrom, "", blueprintName);
+ String modelType = getModelType(entry, nodeTemplateList);
+ return new MicroService(name, modelType, getInputFrom, "");
}
private String getTarget(JsonObject elementObject) {
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
index 5a21a1f8d..7ef217b4e 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
@@ -132,7 +132,7 @@ public class CsarHandler {
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
- if (entry.getName().contains(BLUEPRINT_TYPE)) {
+ if (!entry.isDirectory() && entry.getName().contains(BLUEPRINT_TYPE)) {
BlueprintArtifact blueprintArtifact = new BlueprintArtifact();
blueprintArtifact.setBlueprintArtifactName(
entry.getName().substring(entry.getName().lastIndexOf('/') + 1, entry.getName().length()));
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstaller.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstaller.java
index 12a761dbf..a1f8897fb 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstaller.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstaller.java
@@ -27,6 +27,7 @@ import org.onap.clamp.clds.exception.policy.PolicyModelException;
import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
public interface CsarInstaller {
+ String TEMPLATE_NAME_PREFIX = "DCAE-Designer-Template-";
boolean isCsarAlreadyDeployed(CsarHandler csar) throws SdcArtifactInstallerException;
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java
index 6dc418340..6c41e9c66 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java
@@ -56,6 +56,7 @@ import org.onap.clamp.clds.transform.XslTransformer;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.clds.util.drawing.SvgFacade;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
@@ -68,6 +69,7 @@ import org.yaml.snakeyaml.Yaml;
* received from SDC in DB.
*/
@Component
+@Qualifier("oldModelInstaller")
public class CsarInstallerImpl implements CsarInstaller {
private static final EELFLogger logger = EELFManager.getInstance().getLogger(CsarInstallerImpl.class);
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/MicroService.java
index ac4daeffb..9bc7a022a 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/MicroService.java
@@ -29,16 +29,14 @@ import java.util.Objects;
public class MicroService {
private final String name;
private final String modelType;
- private final String blueprintName;
private final String inputFrom;
private String mappedNameJpa;
- public MicroService(String name, String modelType, String inputFrom, String mappedNameJpa, String blueprintName) {
+ public MicroService(String name, String modelType, String inputFrom, String mappedNameJpa) {
this.name = name;
this.inputFrom = inputFrom;
this.mappedNameJpa = mappedNameJpa;
- this.modelType = modelType;
- this.blueprintName = blueprintName;
+ this.modelType = modelType;
}
public String getName() {
@@ -53,15 +51,10 @@ public class MicroService {
return inputFrom;
}
- public String getBlueprintName() {
- return blueprintName;
- }
-
@Override
public String toString() {
return "MicroService{" + "name='" + name + '\'' + ", modelType='" + modelType + '\'' + ", inputFrom='"
- + inputFrom + '\'' + ", mappedNameJpa='" + mappedNameJpa + '\'' + ", blueprintName='"
- + blueprintName + '\'' + '}';
+ + inputFrom + '\'' + ", mappedNameJpa='" + mappedNameJpa + '\'' + '}';
}
public String getMappedNameJpa() {
@@ -81,11 +74,12 @@ public class MicroService {
return false;
}
MicroService that = (MicroService) o;
- return name.equals(that.name) && modelType.equals(that.modelType) && inputFrom.equals(that.inputFrom) && mappedNameJpa.equals(that.mappedNameJpa) && blueprintName.equals(that.blueprintName);
+ return name.equals(that.name) && modelType.equals(that.modelType) && inputFrom.equals(that.inputFrom)
+ && mappedNameJpa.equals(that.mappedNameJpa);
}
@Override
public int hashCode() {
- return Objects.hash(name, modelType, inputFrom, mappedNameJpa, blueprintName);
+ return Objects.hash(name, modelType, inputFrom, mappedNameJpa);
}
}
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java
index bf7c502a1..e81cc15f7 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java
@@ -26,7 +26,6 @@ package org.onap.clamp.clds.service;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
@@ -35,11 +34,9 @@ import java.lang.reflect.Type;
import java.util.Date;
import java.util.List;
import java.util.UUID;
-
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.BadRequestException;
import javax.xml.transform.TransformerException;
-
import org.apache.camel.Produce;
import org.json.simple.parser.ParseException;
import org.onap.clamp.clds.camel.CamelProxy;
@@ -59,7 +56,7 @@ import org.onap.clamp.clds.model.DcaeEvent;
import org.onap.clamp.clds.model.ValueItem;
import org.onap.clamp.clds.model.properties.ModelProperties;
import org.onap.clamp.clds.model.sdc.SdcServiceInfo;
-import org.onap.clamp.clds.sdc.controller.installer.CsarInstallerImpl;
+import org.onap.clamp.clds.sdc.controller.installer.CsarInstaller;
import org.onap.clamp.clds.transform.XslTransformer;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.clds.util.LoggingUtils;
@@ -295,7 +292,7 @@ public class CldsService extends SecureServiceBase {
try {
// Method to call dcae inventory and invoke insert event method
if (cldsModel.canDcaeInventoryCall()
- && !cldsModel.getTemplateName().startsWith(CsarInstallerImpl.TEMPLATE_NAME_PREFIX)) {
+ && !cldsModel.getTemplateName().startsWith(CsarInstaller.TEMPLATE_NAME_PREFIX)) {
dcaeInventoryServices.setEventInventory(cldsModel, getUserId());
}
// This is a blocking call
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 f5bd6e79d..f7bf92bfd 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
@@ -41,7 +41,7 @@ public class SvgFacade {
Painter p = new Painter(svgGraphics2D, dp);
ClampGraphBuilder cgp = new ClampGraphBuilder(p).collector("VES");
cgp.addAllMicroServices(microServicesChain);
- ClampGraph cg = cgp.policy("Policy").build();
+ ClampGraph cg = cgp.policy("OperationalPolicy").build();
return cg.getAsSVG();
}
diff --git a/src/main/java/org/onap/clamp/loop/CsarInstallerImpl.java b/src/main/java/org/onap/clamp/loop/LoopCsarInstaller.java
index f407aa944..ad13ad34d 100644
--- a/src/main/java/org/onap/clamp/loop/CsarInstallerImpl.java
+++ b/src/main/java/org/onap/clamp/loop/LoopCsarInstaller.java
@@ -25,7 +25,6 @@ package org.onap.clamp.loop;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import com.google.gson.Gson;
import com.google.gson.JsonObject;
import java.io.IOException;
@@ -51,9 +50,16 @@ import org.onap.clamp.clds.util.drawing.SvgFacade;
import org.onap.clamp.policy.Policy;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
import org.onap.clamp.policy.operational.OperationalPolicy;
+import org.onap.sdc.tosca.parser.api.IEntityDetails;
+import org.onap.sdc.tosca.parser.elements.queries.EntityQuery;
+import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery;
+import org.onap.sdc.tosca.parser.enums.EntityTemplateType;
import org.onap.sdc.tosca.parser.enums.SdcTypes;
import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.Property;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.yaml.snakeyaml.Yaml;
@@ -63,10 +69,11 @@ import org.yaml.snakeyaml.Yaml;
* There is no state kept by the bean. It's used to deploy the csar/notification
* received from SDC in DB.
*/
-public class CsarInstallerImpl implements CsarInstaller {
+@Component
+@Qualifier("loopInstaller")
+public class LoopCsarInstaller implements CsarInstaller {
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(CsarInstallerImpl.class);
- public static final String TEMPLATE_NAME_PREFIX = "DCAE-Designer-Template-";
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(LoopCsarInstaller.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
@@ -179,21 +186,49 @@ public class CsarInstallerImpl implements CsarInstaller {
return globalProperties;
}
- private JsonObject createModelPropertiesJson(CsarHandler csar) {
- JsonObject modelProperties = new JsonObject();
- Gson gson = new Gson();
- modelProperties.add("serviceDetails",
- gson.fromJson(gson.toJson(csar.getSdcCsarHelper().getServiceMetadataAllProperties()), JsonObject.class));
+ private static JsonObject createVfModuleProperties(CsarHandler csar) {
+ JsonObject vfModuleProps = new JsonObject();
+ // Loop on all Groups defined in the service (VFModule entries type:
+ // org.openecomp.groups.VfModule)
+ for (IEntityDetails entity : csar.getSdcCsarHelper().getEntity(
+ EntityQuery.newBuilder(EntityTemplateType.GROUP).build(),
+ TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE).build(), false)) {
+ // Get all metadata info
+ JsonObject allVfProps = (JsonObject) JsonUtils.GSON.toJsonTree(entity.getMetadata().getAllProperties());
+ vfModuleProps.add(entity.getMetadata().getAllProperties().get("vfModuleModelName"), allVfProps);
+ // now append the properties section so that we can also have isBase,
+ // volume_group, etc ... fields under the VFmodule name
+ for (Entry<String, Property> additionalProp : entity.getProperties().entrySet()) {
+ allVfProps.add(additionalProp.getValue().getName(),
+ JsonUtils.GSON.toJsonTree(additionalProp.getValue().getValue()));
+ }
+ }
+ return vfModuleProps;
+ }
+ private static JsonObject createServicePropertiesByType(CsarHandler csar) {
JsonObject resourcesProp = new JsonObject();
+ // Iterate on all types defined in the tosca lib
for (SdcTypes type : SdcTypes.values()) {
JsonObject resourcesPropByType = new JsonObject();
+ // For each type, get the metadata of each nodetemplate
for (NodeTemplate nodeTemplate : csar.getSdcCsarHelper().getServiceNodeTemplateBySdcType(type)) {
- resourcesPropByType.add(nodeTemplate.getName(), JsonUtils.GSON_JPA_MODEL
- .fromJson(new Gson().toJson(nodeTemplate.getMetaData().getAllProperties()), JsonObject.class));
+ resourcesPropByType.add(nodeTemplate.getName(),
+ JsonUtils.GSON.toJsonTree(nodeTemplate.getMetaData().getAllProperties()));
}
resourcesProp.add(type.getValue(), resourcesPropByType);
}
+ return resourcesProp;
+ }
+
+ private static JsonObject createModelPropertiesJson(CsarHandler csar) {
+ JsonObject modelProperties = new JsonObject();
+ // Add service details
+ modelProperties.add("serviceDetails", JsonUtils.GSON.fromJson(
+ JsonUtils.GSON.toJson(csar.getSdcCsarHelper().getServiceMetadataAllProperties()), JsonObject.class));
+ // Add properties details for each type, VfModule, VF, VFC, ....
+ JsonObject resourcesProp = createServicePropertiesByType(csar);
+ resourcesProp.add("VFModule", createVfModuleProperties(csar));
modelProperties.add("resourceDetails", resourcesProp);
return modelProperties;
}
diff --git a/src/main/java/org/onap/clamp/loop/LoopOperation.java b/src/main/java/org/onap/clamp/loop/LoopOperation.java
index 3f4c52939..c3eb08be7 100644
--- a/src/main/java/org/onap/clamp/loop/LoopOperation.java
+++ b/src/main/java/org/onap/clamp/loop/LoopOperation.java
@@ -31,23 +31,21 @@ import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
+import java.io.IOException;
import java.lang.reflect.Array;
import java.util.Collection;
-import java.util.Date;
+import java.util.Iterator;
import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
+import java.util.Set;
import org.apache.camel.Exchange;
-import org.onap.clamp.clds.client.DcaeDispatcherServices;
+import org.apache.camel.Message;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
import org.onap.clamp.clds.config.ClampProperties;
-import org.onap.clamp.clds.util.LoggingUtils;
-import org.onap.clamp.clds.util.ONAPLogConstants;
-import org.onap.clamp.exception.OperationException;
-import org.onap.clamp.util.HttpConnectionManager;
-import org.slf4j.event.Level;
+import org.onap.clamp.policy.operational.OperationalPolicy;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.yaml.snakeyaml.Yaml;
@@ -59,117 +57,198 @@ public class LoopOperation {
protected static final EELFLogger logger = EELFManager.getInstance().getLogger(LoopOperation.class);
protected static final EELFLogger auditLogger = EELFManager.getInstance().getMetricsLogger();
- private final DcaeDispatcherServices dcaeDispatcherServices;
+ private static final String DCAE_LINK_FIELD = "links";
+ private static final String DCAE_STATUS_FIELD = "status";
+ private static final String DCAE_DEPLOYMENT_TEMPLATE = "dcae.deployment.template";
+ private static final String DCAE_SERVICETYPE_ID = "serviceTypeId";
+ private static final String DCAE_INPUTS = "inputs";
+ private static final String DCAE_DEPLOYMENT_PREFIX = "closedLoop_";
+ private static final String DCAE_DEPLOYMENT_SUFIX = "_deploymentId";
private final LoopService loopService;
- private LoggingUtils util = new LoggingUtils(logger);
+ private final ClampProperties refProp;
- @Autowired
- private HttpServletRequest request;
+ public enum TempLoopState {
+ NOT_SUBMITTED, SUBMITTED, DEPLOYED, NOT_DEPLOYED, PROCESSING, IN_ERROR;
+ }
+ /**
+ * The constructor.
+ * @param loopService The loop service
+ * @param refProp The clamp properties
+ */
@Autowired
- public LoopOperation(LoopService loopService, DcaeDispatcherServices dcaeDispatcherServices,
- ClampProperties refProp, HttpConnectionManager httpConnectionManager) {
+ public LoopOperation(LoopService loopService, ClampProperties refProp) {
this.loopService = loopService;
- this.dcaeDispatcherServices = dcaeDispatcherServices;
+ this.refProp = refProp;
}
-
+
/**
- * Deploy the closed loop.
+ * Get the payload used to send the deploy closed loop request.
*
- * @param loopName
- * the loop name
- * @return the updated loop
- * @throws OperationException
- * Exception during the operation
+ * @param loop The loop
+ * @return The payload used to send deploy closed loop request
+ * @throws IOException IOException
*/
- public Loop deployLoop(Exchange camelExchange, String loopName) throws OperationException {
- util.entering(request, "CldsService: Deploy model");
- Date startTime = new Date();
- Loop loop = loopService.getLoop(loopName);
-
- if (loop == null) {
- String msg = "Deploy loop exception: Not able to find closed loop:" + loopName;
- util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), msg, Level.INFO,
- ONAPLogConstants.ResponseStatus.ERROR);
- throw new OperationException(msg);
- }
+ public String getDeployPayload(Loop loop) throws IOException {
+ Yaml yaml = new Yaml();
+ Map<String, Object> yamlMap = yaml.load(loop.getBlueprint());
+ JsonObject bluePrint = wrapSnakeObject(yamlMap).getAsJsonObject();
+
+ String serviceTypeId = loop.getDcaeBlueprintId();
- // verify the current closed loop state
- if (loop.getLastComputedState() != LoopState.SUBMITTED) {
- String msg = "Deploy loop exception: This closed loop is in state:" + loop.getLastComputedState()
- + ". It could be deployed only when it is in SUBMITTED state.";
- util.exiting(HttpStatus.CONFLICT.toString(), msg, Level.INFO, ONAPLogConstants.ResponseStatus.ERROR);
- throw new OperationException(msg);
+ JsonObject rootObject = refProp.getJsonTemplate(DCAE_DEPLOYMENT_TEMPLATE).getAsJsonObject();
+ rootObject.addProperty(DCAE_SERVICETYPE_ID, serviceTypeId);
+ if (bluePrint != null) {
+ rootObject.add(DCAE_INPUTS, bluePrint);
}
+ String apiBodyString = rootObject.toString();
+ logger.info("Dcae api Body String - " + apiBodyString);
+ return apiBodyString;
+ }
+
+ /**
+ * Get the deployment id.
+ *
+ * @param loop The loop
+ * @return The deployment id
+ * @throws IOException IOException
+ */
+ public String getDeploymentId(Loop loop) {
// Set the deploymentId if not present yet
String deploymentId = "";
// If model is already deployed then pass same deployment id
if (loop.getDcaeDeploymentId() != null && !loop.getDcaeDeploymentId().isEmpty()) {
deploymentId = loop.getDcaeDeploymentId();
} else {
- loop.setDcaeDeploymentId(deploymentId = "closedLoop_" + loopName + "_deploymentId");
+ deploymentId = DCAE_DEPLOYMENT_PREFIX + loop.getName() + DCAE_DEPLOYMENT_SUFIX;
}
+ return deploymentId;
+ }
- Yaml yaml = new Yaml();
- Map<String, Object> yamlMap = yaml.load(loop.getBlueprint());
- JsonObject bluePrint = wrapSnakeObject(yamlMap).getAsJsonObject();
+ /**
+ * Update the loop info.
+ *
+ * @param camelExchange The camel exchange
+ * @param loop The loop
+ * @param deploymentId The deployment id
+ * @throws ParseException The parse exception
+ */
+ public void updateLoopInfo(Exchange camelExchange, Loop loop, String deploymentId) throws ParseException {
+ Message in = camelExchange.getIn();
+ String msg = in.getBody(String.class);
- loop.setDcaeDeploymentStatusUrl(
- dcaeDispatcherServices.createNewDeployment(deploymentId, loop.getDcaeBlueprintId(), bluePrint));
- loop.setLastComputedState(LoopState.DEPLOYED);
- // save the updated loop
+ JSONParser parser = new JSONParser();
+ Object obj0 = parser.parse(msg);
+ JSONObject jsonObj = (JSONObject) obj0;
+
+ JSONObject linksObj = (JSONObject) jsonObj.get(DCAE_LINK_FIELD);
+ String statusUrl = (String) linksObj.get(DCAE_STATUS_FIELD);
+
+ // use http4 instead of http, because camel http4 component is used to do the http call
+ String newStatusUrl = statusUrl.replaceAll("http:", "http4:");
+
+ loop.setDcaeDeploymentId(deploymentId);
+ loop.setDcaeDeploymentStatusUrl(newStatusUrl);
loopService.saveOrUpdateLoop(loop);
+ }
- // audit log
- LoggingUtils.setTimeContext(startTime, new Date());
- auditLogger.info("Deploy model completed");
- util.exiting(HttpStatus.OK.toString(), "Successful", Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED);
- return loop;
+ /**
+ * Get the Closed Loop status based on the reply from Policy.
+ *
+ * @param statusCode The status code
+ * @return The state based on policy response
+ * @throws ParseException The parse exception
+ */
+ public String analysePolicyResponse(int statusCode) {
+ if (statusCode == 200) {
+ return TempLoopState.SUBMITTED.toString();
+ } else if (statusCode == 404) {
+ return TempLoopState.NOT_SUBMITTED.toString();
+ }
+ return TempLoopState.IN_ERROR.toString();
}
/**
- * Un deploy closed loop.
+ * Get the name of the first Operational policy.
*
- * @param loopName
- * the loop name
- * @return the updated loop
+ * @param loop The closed loop
+ * @return The name of the first operational policy
*/
- public Loop unDeployLoop(String loopName) throws OperationException {
- util.entering(request, "LoopOperation: Undeploy the closed loop");
- Date startTime = new Date();
- Loop loop = loopService.getLoop(loopName);
-
- if (loop == null) {
- String msg = "Undeploy loop exception: Not able to find closed loop:" + loopName;
- util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), msg, Level.INFO,
- ONAPLogConstants.ResponseStatus.ERROR);
- throw new OperationException(msg);
+ public String getOperationalPolicyName(Loop loop) {
+ Set<OperationalPolicy> opSet = (Set<OperationalPolicy>)loop.getOperationalPolicies();
+ Iterator<OperationalPolicy> iterator = opSet.iterator();
+ while (iterator.hasNext()) {
+ OperationalPolicy policy = iterator.next();
+ return policy.getName();
}
+ return null;
+ }
- // verify the current closed loop state
- if (loop.getLastComputedState() != LoopState.DEPLOYED) {
- String msg = "Unploy loop exception: This closed loop is in state:" + loop.getLastComputedState()
- + ". It could be undeployed only when it is in DEPLOYED state.";
- util.exiting(HttpStatus.CONFLICT.toString(), msg, Level.INFO, ONAPLogConstants.ResponseStatus.ERROR);
- throw new OperationException(msg);
+ /**
+ * Get the Closed Loop status based on the reply from DCAE.
+ *
+ * @param camelExchange The camel exchange
+ * @return The state based on DCAE response
+ * @throws ParseException The parse exception
+ */
+ public String analyseDcaeResponse(Exchange camelExchange, Integer statusCode) throws ParseException {
+ if (statusCode == null) {
+ return TempLoopState.NOT_DEPLOYED.toString();
}
+ if (statusCode == 200) {
+ Message in = camelExchange.getIn();
+ String msg = in.getBody(String.class);
- loop.setDcaeDeploymentStatusUrl(
- dcaeDispatcherServices.deleteExistingDeployment(loop.getDcaeDeploymentId(), loop.getDcaeBlueprintId()));
+ JSONParser parser = new JSONParser();
+ Object obj0 = parser.parse(msg);
+ JSONObject jsonObj = (JSONObject) obj0;
- // clean the deployment ID
- loop.setDcaeDeploymentId(null);
- loop.setLastComputedState(LoopState.SUBMITTED);
+ String opType = (String) jsonObj.get("operationType");
+ String status = (String) jsonObj.get("status");
- // save the updated loop
- loopService.saveOrUpdateLoop(loop);
+ // status = processing/successded/failed
+ if (status.equals("succeeded")) {
+ if (opType.equals("install")) {
+ return TempLoopState.DEPLOYED.toString();
+ } else if (opType.equals("uninstall")) {
+ return TempLoopState.NOT_DEPLOYED.toString();
+ }
+ } else if (status.equals("processing")) {
+ return TempLoopState.PROCESSING.toString();
+ }
+ } else if (statusCode == 404) {
+ return TempLoopState.NOT_DEPLOYED.toString();
+ }
+ return TempLoopState.IN_ERROR.toString();
+ }
- // audit log
- LoggingUtils.setTimeContext(startTime, new Date());
- auditLogger.info("Undeploy model completed");
- util.exiting(HttpStatus.OK.toString(), "Successful", Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED);
- return loop;
+ /**
+ * Update the status of the closed loop based on the response from Policy and DCAE.
+ *
+ * @param loop The closed loop
+ * @param policyState The state get from Policy
+ * @param dcaeState The state get from DCAE
+ * @throws ParseException The parse exception
+ */
+ public LoopState updateLoopStatus(Loop loop, TempLoopState policyState, TempLoopState dcaeState) {
+ LoopState clState = LoopState.IN_ERROR;
+ if (policyState == TempLoopState.SUBMITTED) {
+ if (dcaeState == TempLoopState.DEPLOYED) {
+ clState = LoopState.DEPLOYED;
+ } else if (dcaeState == TempLoopState.PROCESSING) {
+ clState = LoopState.WAITING;
+ } else if (dcaeState == TempLoopState.NOT_DEPLOYED) {
+ clState = LoopState.SUBMITTED;
+ }
+ } else if (policyState == TempLoopState.NOT_SUBMITTED) {
+ if (dcaeState == TempLoopState.NOT_DEPLOYED) {
+ clState = LoopState.DESIGN;
+ }
+ }
+ loop.setLastComputedState(clState);
+ loopService.saveOrUpdateLoop(loop);
+ return clState;
}
private JsonElement wrapSnakeObject(Object obj) {
diff --git a/src/main/java/org/onap/clamp/loop/log/LoopLog.java b/src/main/java/org/onap/clamp/loop/log/LoopLog.java
index 3edb2ee59..cea495712 100644
--- a/src/main/java/org/onap/clamp/loop/log/LoopLog.java
+++ b/src/main/java/org/onap/clamp/loop/log/LoopLog.java
@@ -69,7 +69,7 @@ public class LoopLog implements Serializable {
private LogType logType;
@Expose
- @Column(name = "message", nullable = false)
+ @Column(name = "message", columnDefinition = "MEDIUMTEXT", nullable = false)
private String message;
@ManyToOne(fetch = FetchType.LAZY)
diff --git a/src/main/java/org/onap/clamp/policy/Policy.java b/src/main/java/org/onap/clamp/policy/Policy.java
index f4efab0d7..fc097bd60 100644
--- a/src/main/java/org/onap/clamp/policy/Policy.java
+++ b/src/main/java/org/onap/clamp/policy/Policy.java
@@ -25,13 +25,15 @@ package org.onap.clamp.policy;
import com.google.gson.JsonObject;
+import java.io.UnsupportedEncodingException;
+
public interface Policy {
String getName();
JsonObject getJsonRepresentation();
- String createPolicyPayload();
+ String createPolicyPayload() throws UnsupportedEncodingException;
/**
* Generate the policy name.
diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
index 1e35ad6c4..906c3cfa8 100644
--- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
+++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
@@ -31,6 +31,9 @@ import com.google.gson.JsonObject;
import com.google.gson.annotations.Expose;
import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
@@ -150,8 +153,7 @@ public class OperationalPolicy implements Serializable, Policy {
return true;
}
- @Override
- public String createPolicyPayload() {
+ public String createPolicyPayloadYaml() {
JsonObject policyPayloadResult = new JsonObject();
policyPayloadResult.addProperty("tosca_definitions_version", "tosca_simple_yaml_1_0_0");
@@ -181,6 +183,16 @@ public class OperationalPolicy implements Serializable, Policy {
return (new Yaml()).dump(jsonMap);
}
+ @Override
+ public String createPolicyPayload() throws UnsupportedEncodingException {
+
+ // Now the Yaml payload must be injected in a json ...
+ JsonObject payload = new JsonObject();
+ payload.addProperty("policy-id", this.getName());
+ payload.addProperty("content", URLEncoder.encode(createPolicyPayloadYaml(), StandardCharsets.UTF_8.toString()));
+ return new GsonBuilder().setPrettyPrinting().create().toJson(payload);
+ }
+
/**
* Return a map containing all Guard policies indexed by Guard policy Name.
*
@@ -194,7 +206,7 @@ public class OperationalPolicy implements Serializable, Policy {
for (Entry<String, JsonElement> guardElem : guardsList.getAsJsonObject().entrySet()) {
JsonObject guard = new JsonObject();
guard.addProperty("policy-id", guardElem.getKey());
- guard.add("contents", guardElem.getValue());
+ guard.add("content", guardElem.getValue());
result.put(guardElem.getKey(), new GsonBuilder().create().toJson(guard));
}
}
diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html
index b7864eca9..db81e4760 100644
--- a/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html
+++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html
@@ -2,7 +2,7 @@
============LICENSE_START=======================================================
ONAP CLAMP
================================================================================
- Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
+ Copyright (C) 2017-2019 AT&T Intellectual Property. All rights
reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
@@ -291,7 +291,7 @@ label {
Type</label>
<div class="col-sm-8">
<select class="form-control" name="type" id="type"
- ng-click="initTargetResourceId()" ng-model="type">
+ ng-click="initTargetResourceId($event)" ng-model="type">
<option value="">-- choose an option --</option>
<option value="VFModule">VFModule</option>
<option value="VM">VM</option>
@@ -304,10 +304,9 @@ label {
Target ResourceId</label>
<div class="col-sm-8">
<select class="form-control" name="resourceId" id="resourceId"
- enableFilter="true" ng-click="changeTargetResourceId()"
+ enableFilter="true" ng-click="changeTargetResourceId($event)"
ng-model="resourceId">
<option value="">-- choose an option --</option>
- <option value="Other:">Other:</option>
</select>
</div>
</div>
@@ -404,34 +403,34 @@ label {
</div>
<div class="form-group clearfix">
- <label for="guardTargets" class="col-sm-4 control-label">Guard
+ <label for="targets" class="col-sm-4 control-label">Guard
targets</label>
<div class="col-sm-8">
- <input class="form-control" name="guardTargets" id="guardTargets" />
+ <input class="form-control" name="targets" id="targets" />
</div>
</div>
<div class="form-group clearfix" id="minMaxGuardPolicyDiv">
- <label for="minGuard" class="col-sm-4 control-label"> Min
+ <label for="min" class="col-sm-4 control-label"> Min
Guard</label>
<div class="col-sm-8">
- <input class="form-control" name="minGuard" id="minGuard" />
+ <input class="form-control" name="min" id="min" />
</div>
- <label for="maxGuard" class="col-sm-4 control-label"> Max
+ <label for="max" class="col-sm-4 control-label"> Max
Guard</label>
<div class="col-sm-8">
- <input class="form-control" name="maxGuard" id="maxGuard" />
+ <input class="form-control" name="max" id="max" />
</div>
</div>
<div class="form-group clearfix"
id="frequencyLimiterGuardPolicyDiv" style="display: none">
- <label for="limitGuard" class="col-sm-4 control-label">Limit</label>
+ <label for="limit" class="col-sm-4 control-label">Limit</label>
<div class="col-sm-8">
- <input class="form-control" name="limitGuard" id="limitGuard" />
+ <input class="form-control" name="limit" id="limit" />
</div>
<div class="col-sm-8">
- <select class="form-control" name="timeUnitsGuard"
- id="timeUnitsGuard">
+ <select class="form-control" name="timeUnits"
+ id="timeUnits">
<option value=""></option>
<option value="minute">minute</option>
<option value="hour">hour</option>
@@ -440,12 +439,12 @@ label {
<option value="month">month</option>
<option value="year">year</option>
- </select> <label for="timeWindowGuard" class="col-sm-4 control-label">Time
+ </select> <label for="timeWindow" class="col-sm-4 control-label">Time
Window</label>
</div>
<div class="col-sm-8">
- <input class="form-control" name="timeWindowGuard"
- id="timeWindowGuard" />
+ <input class="form-control" name="timeWindow"
+ id="timeWindow" />
</div>
</div>
<div class="form-group clearfix">
diff --git a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
index 34e90e632..38cdc9388 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
@@ -34,7 +34,7 @@ app
//This will open the methods located in the app.js
if (undefined == name) {
return;
- }else if (name.toLowerCase().indexOf("policy") >= 0){
+ }else if (name === "OperationalPolicy"){
PolicyWindow();
} else {
$rootScope.selectedBoxName = name;
diff --git a/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js
index 2c3f83e41..0cf4c2e3a 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -55,7 +55,6 @@ app
}
console.log("No active formId found !");
}
-
function add_one_more() {
console.log("add one more");
@@ -154,10 +153,9 @@ app
policiesArray.push(policyProperties);
// Now get the Guard
if ($("#" + this.id + " #enableGuardPolicy").is(':checked')) {
- var guardPolicyBody = serializeElement($("#" + this.id + " .guardProperties"));
- var guardPolicyId = guardPolicyBody['id'];
- delete guardPolicyBody['id'];
-
+ var guardPolicyBody = serializeElement($("#" + this.id + " .guardProperties"));
+ var guardPolicyId = guardPolicyBody['id'];
+ delete guardPolicyBody['id'];
allPolicies['guard_policies'][guardPolicyId] = guardPolicyBody;
$scope.guard_ids.push(guardPolicyId);
}
@@ -190,9 +188,14 @@ app
var formNum = add_one_more();
$.each($('.policyProperties').find('.form-control'), function(opPolicyPropIndex, opPolicyPropValue) {
- $("#formId"+formNum+" .policyProperties").find("#"+opPolicyPropValue.id).val(
+ $("#formId" + formNum + " .policyProperties").find("#" + opPolicyPropValue.id).val(
allPolicies['operational_policy']['policies'][opPolicyElemIndex][opPolicyPropValue.id]);
});
+ $.each($('.policyTarget').find('.form-control'), function(opPolicyTargetPropIndex, opPolicyTargetPropValue) {
+
+ $("#formId" + formNum + " .policyTarget").find("#" + opPolicyTargetPropValue.id).val(
+ allPolicies['operational_policy']['policies'][opPolicyElemIndex]['target'][opPolicyTargetPropValue.id]);
+ });
// update the current tab label
$("#go_properties_tab" + formNum).text(
allPolicies['operational_policy']['policies'][opPolicyElemIndex]['id']);
@@ -201,9 +204,11 @@ app
if (guardElemValue.recipe === $($("#formId" + formNum + " #recipe")[0]).val()) {
// Found one, set all guard prop
- $.each($('.guardProperties').find('.form-control'), function(guardPropElemIndex,guardPropElemValue) {
- guardElemValue['id'] = guardElemId;
- $("#formId"+formNum+" .guardProperties").find("#"+guardPropElemValue.id).val(
+ $.each($('.guardProperties').find('.form-control'), function(guardPropElemIndex,
+ guardPropElemValue) {
+
+ guardElemValue['id'] = guardElemId;
+ $("#formId" + formNum + " .guardProperties").find("#" + guardPropElemValue.id).val(
guardElemValue[guardPropElemValue.id]);
});
// And finally enable the flag
@@ -212,108 +217,69 @@ app
});
});
}
-
- $scope.initTargetResourceId = function() {
-
- var recipe = $(event.target).val();
-
- var type = $(event.target).val();
-
- $("#modelName").val("");
- $("#modelInvariantId").val("");
- $("#modelVersionId").val("");
- $("#modelVersion").val("");
- $("#modelCustomizationId").val("");
- $('#resourceId').empty();
- $("#resourceId")
- .append(
- $('<option></option>').val("")
- .html("-- choose an option --"));
- $("#resourceId").append(
- $('<option></option>').val("Other:")
- .html("Other:"));
- if (type == "VM" || type == "" || type == "VNF" ) {
- $("#metadata *").prop('disabled',true);
- }
-
- var resourceVnf = getResourceDetailsProperty();
- if (type == "VNF"
- && (null !== resourceVnf || undefined !== resourceVnf)) {
- for ( var prop in resourceVnf) {
- var name = resourceVnf[prop]["name"];
- $("#resourceId").append(
- $('<option></option>')
- .val(name).html(name));
- }
-
- }
- var resourceVFModule = getResourceDetailsVfModuleProperty();
- if (type == "VFModule"
- && (null !== resourceVFModule || undefined !== resourceVFModule)) {
- if (recipe == 'VF Module Create'
- || recipe == 'VF Module Delete') {
- for ( var prop in resourceVFModule) {
- if (resourceVFModule[prop]["isBase"] == false) {
- var name = resourceVFModule[prop]["name"];
- $("#resourceId").append(
- $('<option></option>')
- .val(name)
- .html(name));
- }
- }
- }
- else
- {
- for ( var prop in resourceVFModule) {
- var name = resourceVFModule[prop]["name"];
- $("#resourceId").append(
- $('<option></option>')
- .val(name).html(name));
- }
- }
- }
- }
-
- $scope.changeTargetResourceId = function() {
- $("#modelName").val("");
- $("#modelInvariantId").val("");
- $("#modelVersionId").val("");
- $("#modelVersion").val("");
- $("#modelCustomizationId").val("");
- var resourceVFModule = getResourceDetailsVfModuleProperty();
- var type = $("#type").val();
- var recipe = $("#recipe").val();
- vfBaseName = $(event.target).val();
- if (type == "VFModule"
- && (null !== resourceVFModule || undefined !== resourceVFModule)
- && (recipe == 'VF Module Create' || recipe == 'VF Module Delete')) {
- for ( var prop in resourceVFModule) {
- var name = resourceVFModule[prop]["name"];
- if (name == vfBaseName) {
- var vfModuleModelName = resourceVFModule[prop]["name"];
- $("#modelName").val(
- vfModuleModelName);
- var vfModuleModelInvariantUUID = resourceVFModule[prop]["invariantUUID"];
- $("#modelInvariantId").val(
- vfModuleModelInvariantUUID);
- var vfModuleModelUUID = resourceVFModule[prop]["UUID"];
- $("#modelVersionId").val(
- vfModuleModelUUID);
- var vfModuleModelVersion = resourceVFModule[prop]["version"];
- $("#modelVersion").val(
- vfModuleModelVersion);
- var vfModuleModelCustomizationUUID = resourceVFModule[prop]["customizationUUID"];
- $("#modelCustomizationId")
- .val(
- vfModuleModelCustomizationUUID);
- }
- }
- }
- else {
- $("#metadata *").prop('disabled',true);
- }
- }
-
+ $scope.initTargetResourceId = function(event) {
+ var formNum = $(event.target).closest('.formId').attr('id').substring(6);
+
+ var type = $(event.target).val();
+ var recipe = $("#formId" + formNum + "#recipe").val();
+ $("#formId" + formNum + " #modelName").val("");
+ $("#formId" + formNum + " #modelInvariantId").val("");
+ $("#formId" + formNum + " #modelVersionId").val("");
+ $("#formId" + formNum + " #modelVersion").val("");
+ $("#formId" + formNum + " #modelCustomizationId").val("");
+ $("#formId" + formNum + " #resourceId").empty();
+ $("#formId" + formNum + " #resourceId").append($('<option></option>').val("").html("-- choose an option --"));
+ if (type == "VM" || type == "" || type == "VNF") {
+ $("#formId" + formNum + " #metadata *").prop('disabled', true);
+ }
+ var resourceVnf = getResourceDetailsVfProperty();
+ if (type == "VNF" && (null !== resourceVnf || undefined !== resourceVnf)) {
+ for ( var prop in resourceVnf) {
+ var name = resourceVnf[prop]["name"];
+ $("#formId" + formNum + " #resourceId").append($('<option></option>').val(name).html(name));
+ }
+ }
+ var resourceVFModule = getResourceDetailsVfModuleProperty();
+ if (type == "VFModule" && (null !== resourceVFModule || undefined !== resourceVFModule)) {
+ if (recipe == 'VF Module Create' || recipe == 'VF Module Delete') {
+ for ( var prop in resourceVFModule) {
+ if (resourceVFModule[prop]["isBase"] == false) {
+ $("#formId" + formNum + " #resourceId").append($('<option></option>').val(resourceVFModule[prop]["vfModuleModelName"]).html(resourceVFModule[prop]["vfModuleModelName"]));
+ }
+ }
+ } else {
+ for ( var prop in resourceVFModule) {
+ $("#formId" + formNum + " #resourceId").append($('<option></option>').val(resourceVFModule[prop]["vfModuleModelName"]).html(resourceVFModule[prop]["vfModuleModelName"]));
+ }
+ }
+ }
+ }
+ $scope.changeTargetResourceId = function(event) {
+ var formNum = $(event.target).closest('.formId').attr('id').substring(6);
+ $("#formId" + formNum +" #modelName").val("");
+ $("#formId" + formNum +" #modelInvariantId").val("");
+ $("#formId" + formNum +" #modelVersionId").val("");
+ $("#formId" + formNum +" #modelVersion").val("");
+ $("#formId" + formNum +" #modelCustomizationId").val("");
+ var resourceVFModule = getResourceDetailsVfModuleProperty();
+ var type = $("#formId" + formNum +" #type").val();
+ var recipe = $("#formId" + formNum +" #recipe").val();
+ if (type == "VFModule" && (null !== resourceVFModule || undefined !== resourceVFModule)
+ && (recipe == 'VF Module Create' || recipe == 'VF Module Delete')) {
+ for ( var prop in resourceVFModule) {
+ if (prop == $(event.target).val()) {
+ $("#formId" + formNum +" #modelName").val(resourceVFModule[prop]["vfModuleModelName"]);
+ $("#formId" + formNum +" #modelInvariantId").val(resourceVFModule[prop]["vfModuleModelInvariantUUID"]);
+ $("#formId" + formNum +" #modelVersionId").val(resourceVFModule[prop]["vfModuleModelUUID"]);
+ $("#formId" + formNum +" #modelVersion").val(resourceVFModule[prop]["vfModuleModelVersion"]);
+ $("#formId" + formNum +" #modelCustomizationId").val(resourceVFModule[prop]["vfModuleModelCustomizationUUID"]);
+ $("#formId" + formNum +" #metadata *").prop('disabled', false);
+ }
+ }
+ } else {
+ $("#formId" + formNum +" #metadata *").prop('disabled', true);
+ }
+ }
$scope.changeGuardPolicyType = function() {
var formItemActive = searchActiveFormId();
@@ -343,7 +309,8 @@ app
$scope.init = function() {
$(function() {
- $scope.clname=getLoopName();
+
+ $scope.clname = getLoopName();
$("#add_one_more").click(function(event) {
console.log("add one more");
@@ -359,17 +326,18 @@ app
add_new_policy();
}
$("#savePropsBtn").click(function(event) {
+
console.log("save properties triggered");
savePolicyLocally();
- for(var i = 0; i <= $scope.guard_ids.length; i++) {
- for(var j = i; j <= $scope.guard_ids.length; j++) {
- if(i != j && $scope.guard_ids[i] == $scope.guard_ids[j]) {
- // duplacated guard policy id exist
- alert("The guard policy ID should be unique.");
- return;
- }
- }
- }
+ for (var i = 0; i <= $scope.guard_ids.length; i++) {
+ for (var j = i; j <= $scope.guard_ids.length; j++) {
+ if (i != j && $scope.guard_ids[i] == $scope.guard_ids[j]) {
+ // duplacated guard policy id exist
+ alert("The guard policy ID should be unique.");
+ return;
+ }
+ }
+ }
angular.element(document.getElementById('formSpan')).scope().submitForm(allPolicies);
$("#close_button").click();
});
diff --git a/src/main/resources/META-INF/resources/designer/scripts/propertyController.js b/src/main/resources/META-INF/resources/designer/scripts/propertyController.js
index 3902cf413..ee602b993 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/propertyController.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/propertyController.js
@@ -114,7 +114,7 @@ function setDeploymentStatusURL(deploymentStatusURL) {
cl_props["dcaeDeploymentStatusUrl"] = deploymentStatusURL;
}
-function getResourceDetailsProperty() {
+function getResourceDetailsVfProperty() {
return cl_props["modelPropertiesJson"]["resourceDetails"]["VF"];
}
@@ -126,4 +126,4 @@ function getLoopLogsArray() {
return cl_props.loopLogs;
}
-module.exports = { getOperationalPolicyProperty,getGlobalProperty,getMsProperty,getMsUI,getLastUpdatedStatus,getDeploymentID,getDeploymentStatusURL,getResourceDetailsProperty,getResourceDetailsVfModuleProperty }; \ No newline at end of file
+module.exports = { getOperationalPolicyProperty,getGlobalProperty,getMsProperty,getMsUI,getLastUpdatedStatus,getDeploymentID,getDeploymentStatusURL,getResourceDetailsVfProperty,getResourceDetailsVfModuleProperty }; \ No newline at end of file
diff --git a/src/main/resources/application-noaaf.properties b/src/main/resources/application-noaaf.properties
index 736d1fa1f..52f79bef4 100644
--- a/src/main/resources/application-noaaf.properties
+++ b/src/main/resources/application-noaaf.properties
@@ -55,7 +55,7 @@ server.port=8080
server.servlet.context-path=/
#Modified engine-rest applicationpath
-spring.profiles.active=clamp-default,clamp-default-user,clamp-sdc-controller
+spring.profiles.active=clamp-default,clamp-default-user,clamp-sdc-controller-new
spring.http.converters.preferred-json-mapper=gson
#The max number of active threads in this pool
@@ -135,9 +135,12 @@ clamp.config.dcae.deployment.template=classpath:/clds/templates/dcae-deployment-
#
#
# Configuration Settings for Policy Engine Components
-clamp.config.policy.url=http4://policy.api.simpledemo.onap.org:8081
-clamp.config.policy.userName=test
-clamp.config.policy.password=test
+clamp.config.policy.api.url=http4://policy.api.simpledemo.onap.org:6969
+clamp.config.policy.api.userName=healthcheck
+clamp.config.policy.api.password=zb!XztG34
+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
@@ -207,6 +210,11 @@ clamp.config.dcae.dispatcher.url=http://dcae.api.simpledemo.onap.org:8188
clamp.config.dcae.dispatcher.retry.interval=20000
clamp.config.dcae.dispatcher.retry.limit=30
+#DCAE Deployment Url Properties
+clamp.config.dcae.deployment.url=http4://dcae.api.simpledemo.onap.org:8188
+clamp.config.dcae.deployment.userName=test
+clamp.config.dcae.deployment.password=test
+
#Define user permission related parameters, the permission type can be changed but MUST be redefined in clds-users.properties in that case !
clamp.config.security.permission.type.cl=org.onap.clamp.clds.cl
clamp.config.security.permission.type.cl.manage=org.onap.clamp.clds.cl.manage
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index cf85f8869..534dc4818 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -5,6 +5,8 @@
# Copyright (C) 2017-2019 AT&T Intellectual Property. All rights
# reserved.
# ================================================================================
+# Modifications copyright (c) 2019 Nokia
+# ================================================================================\
# 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
@@ -68,11 +70,11 @@ server.ssl.client-auth=want
server.ssl.trust-store=classpath:/clds/aaf/truststoreONAPall.jks
server.ssl.trust-store-password=changeit
-server.http-to-https-redirection.port=8080
+#server.http-to-https-redirection.port=8080
server.servlet.context-path=/
#Modified engine-rest applicationpath
-spring.profiles.active=clamp-default,clamp-aaf-authentication,clamp-sdc-controller
+spring.profiles.active=clamp-default,clamp-aaf-authentication,clamp-sdc-controller-new
spring.http.converters.preferred-json-mapper=gson
#The max number of active threads in this pool
@@ -150,9 +152,13 @@ clamp.config.dcae.deployment.template=classpath:/clds/templates/dcae-deployment-
#
#
# Configuration Settings for Policy Engine Components
-clamp.config.policy.url=http4://policy.api.simpledemo.onap.org:8081
-clamp.config.policy.userName=test
-clamp.config.policy.password=test
+clamp.config.policy.api.url=http4://policy.api.simpledemo.onap.org:6969
+clamp.config.policy.api.userName=healthcheck
+clamp.config.policy.api.password=zb!XztG34
+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
@@ -222,6 +228,11 @@ clamp.config.dcae.dispatcher.url=http://dcae.api.simpledemo.onap.org:8188
clamp.config.dcae.dispatcher.retry.interval=20000
clamp.config.dcae.dispatcher.retry.limit=30
+#DCAE Deployment Url Properties
+clamp.config.dcae.deployment.url=http4://dcae.api.simpledemo.onap.org:8188
+clamp.config.dcae.deployment.userName=test
+clamp.config.dcae.deployment.password=test
+
#Define user permission related parameters, the permission type can be changed but MUST be redefined in clds-users.properties in that case !
clamp.config.security.permission.type.cl=org.onap.clamp.clds.cl
clamp.config.security.permission.type.cl.manage=org.onap.clamp.clds.cl.manage
diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
index bc1a07feb..4d3c6b389 100644
--- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml
+++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
@@ -5,7 +5,7 @@
outType="java.lang.String[]"
produces="application/json">
<route>
- <removeHeaders pattern="*"/>
+ <removeHeaders pattern="*" />
<doTry>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get All ClosedLoop')" />
@@ -31,7 +31,9 @@
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <removeHeaders pattern="*" excludePattern="loopName"/>
+ <removeHeaders
+ pattern="*"
+ excludePattern="loopName" />
<doTry>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get Closed Loop')" />
@@ -57,7 +59,9 @@
outType="java.lang.String"
produces="application/xml">
<route>
- <removeHeaders pattern="*" excludePattern="loopName"/>
+ <removeHeaders
+ pattern="*"
+ excludePattern="loopName" />
<doTry>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get SVG Representation')" />
@@ -86,7 +90,9 @@
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <removeHeaders pattern="*" excludePattern="loopName"/>
+ <removeHeaders
+ pattern="*"
+ excludePattern="loopName" />
<doTry>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update the global properties')" />
@@ -120,7 +126,9 @@
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <removeHeaders pattern="*" excludePattern="loopName"/>
+ <removeHeaders
+ pattern="*"
+ excludePattern="loopName" />
<doTry>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update operational policies')" />
@@ -154,7 +162,9 @@
outType="org.onap.clamp.policy.microservice.MicroServicePolicy"
produces="application/json">
<route>
- <removeHeaders pattern="*" excludePattern="loopName"/>
+ <removeHeaders
+ pattern="*"
+ excludePattern="loopName" />
<doTry>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update Microservice policies')" />
@@ -187,14 +197,39 @@
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <removeHeaders pattern="*" excludePattern="loopName"/>
+ <removeHeaders
+ pattern="*"
+ excludePattern="loopName" />
<doTry>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Deploy the closed loop')" />
<to
uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
<to
- uri="bean:org.onap.clamp.operation.LoopOperation?method=deployLoop(*,${header.loopName})" />
+ uri="direct:load-loop" />
+ <to
+ uri="direct:get-status-from-policy" />
+ <to
+ uri="direct:get-status-from-dcae" />
+ <log
+ loggingLevel="INFO"
+ message="policy status0000: ${exchangeProperty[policyStatus]}"></log>
+ <choice>
+ <when>
+ <simple> ${exchangeProperty[policyStatus]} == 'SUBMITTED' and
+ ${exchangeProperty[dcaeStatus]} == 'NOT_DEPLOYED'
+ </simple>
+ <to
+ uri="direct:deploy-closedloop" />
+ </when>
+ <otherwise>
+ <log
+ loggingLevel="INFO"
+ message="Closed Loop is in state ${exchangeProperty[policyStatus]}, it can only be deployed when in state SUBMIT" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Closed Loop is in state ${exchangeProperty[policyStatus]}, it can only be deployed when in state SUBMIT','ERROR',${exchangeProperty[loopObject]})" />
+ </otherwise>
+ </choice>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
<doCatch>
@@ -204,6 +239,11 @@
</handled>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ <log
+ loggingLevel="ERROR"
+ message="Deploy request failed for loop: ${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Deploy request failed','ERROR',${exchangeProperty[loopObject]})" />
</doCatch>
</doTry>
</route>
@@ -213,14 +253,33 @@
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <removeHeaders pattern="*" excludePattern="loopName"/>
+ <removeHeaders
+ pattern="*"
+ excludePattern="loopName" />
<doTry>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Undeploy the closed loop')" />
<to
uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
<to
- uri="bean:org.onap.clamp.operation.LoopOperation?method=unDeployLoop(${header.loopName})" />
+ uri="direct:load-loop" />
+ <to
+ uri="direct:get-status-from-dcae" />
+ <choice>
+ <when>
+ <simple> ${exchangeProperty[dcaeStatus]} == 'DEPLOYED'
+ </simple>
+ <to
+ uri="direct:undeploy-closedloop" />
+ </when>
+ <otherwise>
+ <log
+ loggingLevel="INFO"
+ message="Closed Loop is in state ${exchangeProperty[dcaeStatus]}, it can only be undeployed when in state DEPLOYED" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Closed Loop is in state ${exchangeProperty[dcaeStatus]}, it can only be deployed when in state DEPLOYED','ERROR',${exchangeProperty[loopObject]})" />
+ </otherwise>
+ </choice>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
<doCatch>
@@ -230,6 +289,11 @@
</handled>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ <log
+ loggingLevel="ERROR"
+ message="Undeploy request failed for loop: $${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Undeploy request failed','ERROR',${exchangeProperty[loopObject]})" />
</doCatch>
</doTry>
</route>
@@ -239,7 +303,9 @@
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <removeHeaders pattern="*" excludePattern="loopName"/>
+ <removeHeaders
+ pattern="*"
+ excludePattern="loopName" />
<doTry>
<log
loggingLevel="INFO"
@@ -249,20 +315,7 @@
<to
uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
<to uri="direct:load-loop" />
-
- <doTry>
- <to uri="direct:remove-all-policy-from-active-pdp-group" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doCatch>
- </doTry>
-
-
+ <to uri="direct:remove-all-policy-from-active-pdp-group" />
<log
loggingLevel="INFO"
message="STOP request successfully executed for loop: ${body}" />
@@ -279,6 +332,11 @@
</handled>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ <log
+ loggingLevel="ERROR"
+ message="STOP request failed for loop: $${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request failed, Error reported: ${exception}','ERROR',${exchangeProperty[loopObject]})" />
</doCatch>
</doTry>
</route>
@@ -288,7 +346,9 @@
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <removeHeaders pattern="*" excludePattern="loopName"/>
+ <removeHeaders
+ pattern="*"
+ excludePattern="loopName" />
<doTry>
<log
loggingLevel="INFO"
@@ -299,21 +359,11 @@
uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
<to uri="direct:load-loop" />
- <doTry>
- <to uri="direct:add-all-to-active-pdp-group" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doCatch>
- </doTry>
+ <to uri="direct:add-all-to-active-pdp-group" />
<log
loggingLevel="INFO"
- message="START request successfully executed for loop: ${body}" />
+ message="START request successfully executed for loop: ${header.loopName}" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('START request successfully executed','INFO',${exchangeProperty[loopObject]})" />
<to
@@ -327,6 +377,11 @@
</handled>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ <log
+ loggingLevel="ERROR"
+ message="START request failed for loop: ${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('START request failed, Error reported: ${exception}','INFO',${exchangeProperty[loopObject]})" />
</doCatch>
</doTry>
</route>
@@ -336,7 +391,9 @@
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <removeHeaders pattern="*" excludePattern="loopName"/>
+ <removeHeaders
+ pattern="*"
+ excludePattern="loopName" />
<doTry>
<log
loggingLevel="INFO"
@@ -351,19 +408,7 @@
<setProperty propertyName="raiseHttpExceptionFlag">
<simple resultType="java.lang.Boolean">false</simple>
</setProperty>
-
- <doTry>
- <to uri="direct:remove-all-policy-from-active-pdp-group" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doCatch>
- </doTry>
-
+ <to uri="direct:remove-all-policy-from-active-pdp-group" />
<log
loggingLevel="INFO"
message="Processing all MICRO-SERVICES policies defined in loop ${exchangeProperty[loopObject].getName()}" />
@@ -379,31 +424,8 @@
<setProperty propertyName="raiseHttpExceptionFlag">
<simple resultType="java.lang.Boolean">false</simple>
</setProperty>
-
- <doTry>
- <to uri="direct:delete-micro-service-policy" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doCatch>
- </doTry>
-
- <doTry>
- <to uri="direct:create-micro-service-policy" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doCatch>
- </doTry>
-
+ <to uri="direct:delete-micro-service-policy" />
+ <to uri="direct:create-micro-service-policy" />
</split>
<log
loggingLevel="INFO"
@@ -421,30 +443,8 @@
<simple resultType="java.lang.Boolean">false</simple>
</setProperty>
- <doTry>
- <to uri="direct:delete-operational-policy" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doCatch>
- </doTry>
-
- <doTry>
- <to uri="direct:create-operational-policy" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doCatch>
- </doTry>
-
+ <to uri="direct:delete-operational-policy" />
+ <to uri="direct:create-operational-policy" />
<log
loggingLevel="INFO"
@@ -462,52 +462,16 @@
<setProperty propertyName="raiseHttpExceptionFlag">
<simple resultType="java.lang.Boolean">false</simple>
</setProperty>
-
- <doTry>
- <to uri="direct:delete-guard-policy" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doCatch>
- </doTry>
-
- <doTry>
- <to uri="direct:create-guard-policy" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doCatch>
- </doTry>
-
+ <to uri="direct:delete-guard-policy" />
+ <to uri="direct:create-guard-policy" />
</split>
</split>
-
- <doTry>
- <to uri="direct:add-all-to-active-pdp-group" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doCatch>
- </doTry>
-
-
+ <to uri="direct:add-all-to-active-pdp-group" />
<log
loggingLevel="INFO"
- message="SUBMIT request successfully executed for loop: ${body}" />
+ message="SUBMIT request successfully executed for loop: ${header.loopName}" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('SUBMIT request successfully executed','INFO',${exchangeProperty[loopObject]})" />
<to
@@ -521,13 +485,20 @@
</handled>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ <log
+ loggingLevel="ERROR"
+ message="SUBMIT request failed for loop: ${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('SUBMIT request failed, Error reported: ${exception}','ERROR',${exchangeProperty[loopObject]})" />
</doCatch>
</doTry>
</route>
</put>
<put uri="/v2/loop/delete/{loopName}">
<route>
- <removeHeaders pattern="*" excludePattern="loopName"/>
+ <removeHeaders
+ pattern="*"
+ excludePattern="loopName" />
<doTry>
<log
loggingLevel="INFO"
@@ -539,20 +510,7 @@
<to uri="direct:load-loop" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Receive DELETE request','INFO',${exchangeProperty[loopObject]})" />
-
- <doTry>
- <to uri="direct:remove-all-policy-from-active-pdp-group" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doCatch>
- </doTry>
-
-
+ <to uri="direct:remove-all-policy-from-active-pdp-group" />
<split>
<simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
</simple>
@@ -562,19 +520,7 @@
<log
loggingLevel="INFO"
message="Processing Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
-
- <doTry>
- <to uri="direct:delete-micro-service-policy" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doCatch>
- </doTry>
-
+ <to uri="direct:delete-micro-service-policy" />
</split>
<log
@@ -589,19 +535,7 @@
<log
loggingLevel="INFO"
message="Processing Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" />
-
- <doTry>
- <to uri="direct:delete-operational-policy" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doCatch>
- </doTry>
-
+ <to uri="direct:delete-operational-policy" />
<log
loggingLevel="INFO"
message="Processing all GUARD policies defined in loop ${exchangeProperty[loopObject].getName()}" />
@@ -614,26 +548,14 @@
<log
loggingLevel="INFO"
message="Processing Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" />
-
- <doTry>
- <to uri="direct:delete-guard-policy" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doCatch>
- </doTry>
-
+ <to uri="direct:delete-guard-policy" />
</split>
</split>
<to
uri="bean:org.onap.clamp.loop.log.LoopService?method=deleteLoop(${header.loopName})" />
<log
loggingLevel="INFO"
- message="DELETE request successfully executed for loop: ${body}" />
+ message="DELETE request successfully executed for loop: ${header.loopName}" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request successfully executed','INFO',${exchangeProperty[loopObject]})" />
<to
@@ -645,9 +567,63 @@
</handled>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ <log
+ loggingLevel="ERROR"
+ message="DELETE request failed for loop: ${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request failed, Error reported: ${exception}','ERROR',${exchangeProperty[loopObject]})" />
</doCatch>
</doTry>
</route>
</put>
+ <get
+ uri="/v2/loop/getstatus/{loopName}"
+ outType="org.onap.clamp.loop.Loop"
+ produces="application/json">
+ <route>
+ <removeHeaders pattern="*" excludePattern="loopName"/>
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Get current status for loop: ${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get the closed loop status')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
+ <to uri="direct:load-loop" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Receive GET STATUS request','INFO',${exchangeProperty[loopObject]})" />
+ <setProperty propertyName="raiseHttpExceptionFlag">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setProperty>
+ <to uri="direct:get-status-from-policy" />
+ <to uri="direct:get-status-from-dcae" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopOperation?method=updateLoopStatus(${exchangeProperty[loopObject]},${exchangeProperty[policyStatus]}, ${exchangeProperty[dcaeStatus]})" />
+ <log
+ loggingLevel="INFO"
+ message="Get Status request successfully executed. The new state is: ${body}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Get Status request successfully executed','INFO',${exchangeProperty[loopObject]})" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
+ <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="Get Status request failed for loop: ${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Get Status request failed','ERROR',${exchangeProperty[loopObject]})" />
+ </doCatch>
+ </doTry>
+ </route>
+ </get>
</rest>
</rests>
diff --git a/src/main/resources/clds/camel/routes/flexible-flow.xml b/src/main/resources/clds/camel/routes/flexible-flow.xml
index 224502056..5f8577720 100644
--- a/src/main/resources/clds/camel/routes/flexible-flow.xml
+++ b/src/main/resources/clds/camel/routes/flexible-flow.xml
@@ -101,304 +101,420 @@
<route id="create-micro-service-policy">
<from uri="direct:create-micro-service-policy" />
-
- <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.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('MicroService policy created successfully','INFO',${exchangeProperty[loopObject]})" />
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <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;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
+ <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>
+ <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;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
- <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.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}"></log>
- <toD
- uri="{{clamp.config.policy.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('MicroService policy deleted successfully','INFO',${exchangeProperty[loopObject]})" />
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <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>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
</route>
<route id="create-operational-policy">
<from uri="direct:create-operational-policy" />
-
- <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/yaml; legacy-version</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.url}}/policy/api/v1/policytypes/onap.policies.controlloop.operational/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.url}}/policy/api/v1/policytypes/onap.policies.controlloop.operational/versions/1.0.0/policies?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational policy created successfully','INFO',${exchangeProperty[loopObject]})" />
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <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;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
+ <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>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
</route>
<route id="delete-operational-policy">
<from uri="direct:delete-operational-policy" />
-
- <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.url}}/policy/api/v1/policytypes/onap.policies.controlloop.operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}"></log>
- <toD
- uri="{{clamp.config.policy.url}}/policy/api/v1/policytypes/onap.policies.controlloop.operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational policy deleted successfully','INFO',${exchangeProperty[loopObject]})" />
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <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.0.0"></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.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
+ <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>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
</route>
<route id="create-guard-policy">
<from uri="direct:create-guard-policy" />
-
- <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.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Guard policy created successfully','INFO',${exchangeProperty[loopObject]})" />
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <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;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
+ <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>
+ <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.0.0"></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.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}" />
- <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.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}"></log>
- <toD
- uri="{{clamp.config.policy.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}?bridgeEndpoint=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Guard policy deleted successfully','INFO',${exchangeProperty[loopObject]})" />
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <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>
+ <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].createPoliciesPayloadPdpGroup()}
+ </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"></log>
+ <toD
+ uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps?bridgeEndpoint=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;useSystemProperties=true&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}" />
- <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].createPoliciesPayloadPdpGroup()}
- </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.url}}/policy/pap/v1/pdps"></log>
- <toD
- uri="{{clamp.config.policy.url}}/policy/pap/v1/pdps?throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authMethod=Basic&amp;authUsername=test&amp;authPassword=test" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Policies pushed to PDP Group successfully','INFO',${exchangeProperty[loopObject]})" />
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <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>
+ <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" />
- <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].listPolicyNamesPdpGroup()}
+ <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].listPolicyNamesPdpGroup()}
+ </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;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}" />
+ <setProperty propertyName="logMessage">
+ <simple>${exchangeProperty[policyName]} PDP Group removal status
+ </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>
+ <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="deploy-closedloop">
+ <from uri="direct:deploy-closedloop" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Deploy the closed loop: ${exchangeProperty[loopObject].getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Deploy closed loop')" />
+ <simple>${exchangeProperty[loopObject].getOperationalPolicies()}
</simple>
- <setProperty propertyName="policyName">
+ <setProperty propertyName="operationalPolicy">
<simple>${body}</simple>
</setProperty>
<setBody>
- <constant>null</constant>
+ <method ref="org.onap.clamp.loop.LoopOperation"
+ method="getDeployPayload(${exchangeProperty[loopObject]})" />
</setBody>
+ <setProperty propertyName="deploymentId">
+ <method ref="org.onap.clamp.loop.LoopOperation"
+ method="getDeploymentId(${exchangeProperty[loopObject]})" />
+ </setProperty>
<setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
+ <constant>PUT</constant>
+ </setHeader>
+ <setHeader headerName="Content-Type">
+ <constant>application/json</constant>
</setHeader>
<setHeader headerName="X-ONAP-RequestID">
<simple>${exchangeProperty[X-ONAP-RequestID]}
@@ -414,21 +530,192 @@
</setHeader>
<log
loggingLevel="INFO"
- message="Endpoint to delete policy from PDP Group: {{clamp.config.policy.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0"></log>
+ message="Endpoint to deploy closed loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[deploymentId]}"></log>
<toD
- uri="{{clamp.config.policy.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0?bridgeEndpoint=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
+ uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[deploymentId]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[RaiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}" />
<to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog(${exchangeProperty[policyName]}' Policy removed from PDP Group successfully','INFO',${exchangeProperty[loopObject]})" />
- </split>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ uri="bean:org.onap.clamp.loop.LoopOperation?method=updateLoopInfo(*,${exchangeProperty[loopObject]},${exchangeProperty[deploymentId]})" />
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>Deploy closed loop status</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
</route>
+ <route id="undeploy-closedloop">
+ <from uri="direct:undeploy-closedloop" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="UNdeploy the closed loop: ${exchangeProperty[loopObject].getName()} : ${exchangeProperty[loopObject].getDcaeDeploymentId()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Undeploy closed loop')" />
+
+ <setBody>
+ <simple>{\"serviceTypeId\": \"${exchangeProperty[loopObject].getDcaeBlueprintId()}\"}
+ </simple>
+ </setBody>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>DELETE</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 undeploy closed loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}"></log>
+ <toD
+ uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[RaiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopOperation?method=updateLoopInfo(*,${exchangeProperty[loopObject]},null)" />
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>Undeploy closed loop status</simple>
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+ </route>
+ <route id="get-status-from-policy">
+ <from uri="direct:get-status-from-policy" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Query Closed Loop status from policy PDP: ${exchangeProperty[loopObject].getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Query operational policies to PDP group')" />
+ <setProperty propertyName="operationalPolicyName">
+ <method ref="org.onap.clamp.loop.LoopOperation"
+ method="getOperationalPolicyName(${exchangeProperty[loopObject]})" />
+ </setProperty>
+ <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 query from Policy PDP: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicyName]}/versions/deployed"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicyName]}/versions/deployed?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}" />
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>Query closed loop from Policy status</simple>
+ </setProperty>
+ <setProperty propertyName="policyStatus">
+ <method ref="org.onap.clamp.loop.LoopOperation"
+ method="analysePolicyResponse(${header.CamelHttpResponseCode})" />
+ </setProperty>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+ </route>
+ <route id="get-status-from-dcae">
+ <from uri="direct:get-status-from-dcae" />
+ <log
+ loggingLevel="INFO"
+ message="Query Closed Loop status from DCAE ${exchangeProperty[loopObject].getName()}" />
+ <choice>
+ <when>
+ <simple>${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()} == null
+ </simple>
+ <setProperty propertyName="dcaeStatus">
+ <method ref="org.onap.clamp.loop.LoopOperation"
+ method="analyseDcaeResponse(*,null)" />
+ </setProperty>
+ <log
+ loggingLevel="INFO"
+ message="dcae status: ${exchangeProperty[dcaeStatus]}"></log>
+ </when>
+ <otherwise>
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Query Closed Loop status from Dcae" />
+ <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 query Closed Loop status: ${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}"></log>
+ <toD
+ uri="${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;httpClient.connectTimeout=10000&amp;authMethod=Basic&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}" />
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ <setProperty propertyName="logMessage">
+ <simple>Query closed loop from DCAE status</simple>
+ </setProperty>
+ <setProperty propertyName="dcaeStatus">
+ <method ref="org.onap.clamp.loop.LoopOperation"
+ method="analyseDcaeResponse(*,${header.CamelHttpResponseCode})" />
+ </setProperty>
+ <log
+ loggingLevel="INFO"
+ message="dcae status: ${exchangeProperty[dcaeStatus]}"></log>
+ <to uri="direct:dump-loop-log-http-response" />
+ </doFinally>
+ </doTry>
+ </otherwise>
+ </choice>
+ </route>
<route id="reset-raise-http-exception-flag">
<from uri="direct:reset-raise-http-exception-flag" />
<setProperty propertyName="raiseHttpExceptionFlag">
<simple resultType="java.lang.Boolean">true</simple>
</setProperty>
</route>
+
+ <route id="dump-loop-log-http-response">
+ <from uri="direct:dump-loop-log-http-response" />
+ <log loggingLevel="INFO" message="${exchangeProperty[logMessage]} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('${exchangeProperty[logMessage]} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}','INFO',${exchangeProperty[loopObject]})" />
+ </route>
</routes> \ No newline at end of file