Rework the logic to create/delete ms config policies.
Issue-ID: CLAMP-303
Change-Id: I317e262ab68280a7518a6e31e82e5fcb0a7f94ed
Signed-off-by: xg353y <xg353y@intl.att.com>
create table micro_service_policies (
name varchar(255) not null,
+ blueprint_name varchar(255) not null,
json_representation json not null,
+ model_type varchar(255) not null,
policy_tosca MEDIUMTEXT not null,
properties json,
shared bit not null,
Date startTime = new Date();\r
LoggingUtils.setTargetContext("DCAE", "getOperationStatus");\r
try {\r
- String responseStr = dcaeHttpConnectionManager.doGeneralHttpQuery(statusUrl, "GET", null, null, "DCAE");\r
+ String responseStr = dcaeHttpConnectionManager.doGeneralHttpQuery(statusUrl, "GET", null, null, "DCAE", null, null);\r
JSONObject jsonObj = parseResponse(responseStr);\r
String operationType = (String) jsonObj.get("operationType");\r
String status = (String) jsonObj.get(DCAE_STATUS_FIELD);\r
String nodeAttr) throws IOException, ParseException {\r
Date startTime = new Date();\r
try {\r
- String responseStr = dcaeHttpConnectionManager.doGeneralHttpQuery(url, requestMethod, payload, contentType, "DCAE");\r
+ String responseStr = dcaeHttpConnectionManager.doGeneralHttpQuery(url, requestMethod, payload, contentType, "DCAE", null, null);\r
JSONObject jsonObj = parseResponse(responseStr);\r
JSONObject linksObj = (JSONObject) jsonObj.get(node);\r
String statusUrl = (String) linksObj.get(nodeAttr);\r
}\r
for (int i = 0; i < retryLimit; i++) {\r
metricsLogger.info("Attempt n°" + i + " to contact DCAE inventory");\r
- String response = httpConnectionManager.doGeneralHttpQuery(fullUrl, "GET", null, null, "DCAE");\r
+ String response = httpConnectionManager.doGeneralHttpQuery(fullUrl, "GET", null, null, "DCAE", null, null);\r
int totalCount = getTotalCountFromDcaeInventoryResponse(response);\r
metricsLogger.info("getDcaeInformation complete: totalCount returned=" + totalCount);\r
if (totalCount > 0) {\r
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
import java.util.Collections;
import java.util.HashSet;
private static final String TYPE = "type";
private static final String PROPERTIES = "properties";
private static final String NAME = "name";
+ private static final String POLICYID = "policy_id";
+ private static final String POLICY_TYPEID = "policy_type_id";
private static final String RELATIONSHIPS = "relationships";
private static final String CLAMP_NODE_RELATIONSHIPS_GETS_INPUT_FROM = "clamp_node.relationships.gets_input_from";
private static final String TARGET = "target";
}
}
String msName = theBiggestMicroServiceKey.toLowerCase().contains(HOLMES_PREFIX) ? HOLMES : TCA;
- return Collections.singletonList(new MicroService(msName, "", ""));
+ return Collections.singletonList(new MicroService(msName, "", "", "", ""));
}
String getName(Entry<String, JsonElement> entry) {
return "";
}
+ String getModelType(Entry<String, JsonElement> entry) {
+ JsonObject ob = entry.getValue().getAsJsonObject();
+ if (ob.has(PROPERTIES)) {
+ JsonObject properties = ob.get(PROPERTIES).getAsJsonObject();
+ if (properties.has(POLICYID)) {
+ JsonObject policyIdObj = properties.get(POLICYID).getAsJsonObject();
+ if (policyIdObj.has(POLICY_TYPEID)) {
+ return policyIdObj.get(POLICY_TYPEID).getAsString();
+ }
+ }
+ }
+ return "";
+ }
+
+ String getBlueprintName(Entry<String, JsonElement> entry) {
+ return entry.getKey();
+ }
+
MicroService getNodeRepresentation(Entry<String, JsonElement> entry) {
String name = getName(entry);
String getInputFrom = getInput(entry);
- return new MicroService(name, getInputFrom, "");
+ String modelType = getModelType(entry);
+ String blueprintName = getBlueprintName(entry);
+ return new MicroService(name, modelType, getInputFrom, "", blueprintName);
}
private String getTarget(JsonObject elementObject) {
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 inputFrom, String mappedNameJpa) {
+ public MicroService(String name, String modelType, String inputFrom, String mappedNameJpa, String blueprintName) {
this.name = name;
this.inputFrom = inputFrom;
this.mappedNameJpa = mappedNameJpa;
+ this.modelType = modelType;
+ this.blueprintName = blueprintName;
}
public String getName() {
return name;
}
+ public String getModelType() {
+ return modelType;
+ }
+
public String getInputFrom() {
return inputFrom;
}
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
@Override
public String toString() {
- return "MicroService{" + "name='" + name + '\'' + ", inputFrom='" + inputFrom + '\'' + ", mappedNameJpa='"
- + mappedNameJpa + '\'' + '}';
+ return "MicroService{" + "name='" + name + '\'' + ", modelType='" + modelType + '\'' + ", inputFrom='" + inputFrom + '\'' + ", mappedNameJpa='"
+ + mappedNameJpa + '\'' + ", blueprintName='" + blueprintName + '\'' + '}';
}
public String getMappedNameJpa() {
return false;
}
MicroService that = (MicroService) o;
- return name.equals(that.name) && inputFrom.equals(that.inputFrom) && mappedNameJpa.equals(that.mappedNameJpa);
+ return name.equals(that.name) && modelType.equals(that.modelType) && inputFrom.equals(that.inputFrom) && mappedNameJpa.equals(that.mappedNameJpa) && blueprintName.equals(that.blueprintName);
}
@Override
public int hashCode() {
- return Objects.hash(name, inputFrom, mappedNameJpa);
+ return Objects.hash(name, modelType, inputFrom, mappedNameJpa, blueprintName);
}
}
Policy.generatePolicyName(microService.getName(), csar.getSdcNotification().getServiceName(),
csar.getSdcNotification().getServiceVersion(),
blueprintArtifact.getResourceAttached().getResourceInstanceName(),
- blueprintArtifact.getBlueprintArtifactName()),
- csar.getPolicyModelYaml().orElse(""), false, new HashSet<>(Arrays.asList(newLoop)));
+ blueprintArtifact.getBlueprintArtifactName()), microService.getModelType(),
+ csar.getPolicyModelYaml().orElse(""), false, new HashSet<>(Arrays.asList(newLoop)), microService.getBlueprintName());
newSet.add(microServicePolicy);
microService.setMappedNameJpa(microServicePolicy.getName());
this.operationalPolicies = operationalPolicies;
}
- Set<MicroServicePolicy> getMicroServicePolicies() {
+ public Set<MicroServicePolicy> getMicroServicePolicies() {
return microServicePolicies;
}
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 org.apache.camel.Exchange;
import org.onap.clamp.clds.client.DcaeDispatcherServices;
+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.loop.Loop;
import org.onap.clamp.loop.LoopService;
import org.onap.clamp.loop.LoopState;
+import org.onap.clamp.policy.PolicyOperation;
+import org.onap.clamp.util.HttpConnectionManager;
import org.slf4j.event.Level;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
private final DcaeDispatcherServices dcaeDispatcherServices;
private final LoopService loopService;
private LoggingUtils util = new LoggingUtils(logger);
+ private PolicyOperation policyOp;
@Autowired
private HttpServletRequest request;
@Autowired
- public LoopOperation(LoopService loopService, DcaeDispatcherServices dcaeDispatcherServices) {
+ public LoopOperation(LoopService loopService, DcaeDispatcherServices dcaeDispatcherServices,
+ ClampProperties refProp, HttpConnectionManager httpConnectionManager, PolicyOperation policyOp) {
this.loopService = loopService;
this.dcaeDispatcherServices = dcaeDispatcherServices;
+ this.policyOp = policyOp;
}
/**
// otherwise take it as a string
return new JsonPrimitive(String.valueOf(o));
}
+
+ /**
+ * Submit the Ms policies.
+ *
+ * @param loopName the loop name
+ * @return the updated loop
+ * @throws IOException IO exception
+ * @throws Exceptions during the operation
+ */
+ public Loop submitMsPolicies (String loopName) throws OperationException, IOException {
+ util.entering(request, "LoopOperation: delete microservice policies");
+ Date startTime = new Date();
+ Loop loop = loopService.getLoop(loopName);
+
+ if (loop == null) {
+ String msg = "Submit MS policies 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);
+ }
+
+ // verify the current closed loop state
+ if (loop.getLastComputedState() != LoopState.SUBMITTED && loop.getLastComputedState() != LoopState.DESIGN) {
+ String msg = "Submit MS policies exception: This closed loop is in state:" + loop.getLastComputedState()
+ + ". It could be deleted only when it is in SUBMITTED state.";
+ util.exiting(HttpStatus.CONFLICT.toString(), msg, Level.INFO,
+ ONAPLogConstants.ResponseStatus.ERROR);
+ throw new OperationException(msg);
+ }
+
+ // Establish the api call to Policy to create the ms services
+ policyOp.createMsPolicy(loop.getMicroServicePolicies());
+
+ // audit log
+ LoggingUtils.setTimeContext(startTime, new Date());
+ auditLogger.info("Deletion of MS policies completed");
+ util.exiting(HttpStatus.OK.toString(), "Successful", Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED);
+ return loop;
+ }
+
+
+ /**
+ * Delete the Ms policies.
+ *
+ * @param loopName the loop name
+ * @return the updated loop
+ * @throws IOException IO exception
+ * @throws Exceptions during the operation
+ */
+ public Loop deleteMsPolicies (Exchange camelExchange, String loopName) throws OperationException, IOException {
+ util.entering(request, "LoopOperation: delete microservice policies");
+ Date startTime = new Date();
+ Loop loop = loopService.getLoop(loopName);
+
+ if (loop == null) {
+ String msg = "Delete MS policies 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);
+ }
+
+ // verify the current closed loop state
+ if (loop.getLastComputedState() != LoopState.SUBMITTED) {
+ String msg = "Delete MS policies exception: This closed loop is in state:" + loop.getLastComputedState()
+ + ". It could be deleted only when it is in SUBMITTED state.";
+ util.exiting(HttpStatus.CONFLICT.toString(), msg, Level.INFO,
+ ONAPLogConstants.ResponseStatus.ERROR);
+ throw new OperationException(msg);
+ }
+
+ // Establish the api call to Policy to create the ms services
+ policyOp.deleteMsPolicy(loop.getMicroServicePolicies());
+
+ // audit log
+ LoggingUtils.setTimeContext(startTime, new Date());
+ auditLogger.info("Deletion of MS policies completed");
+ util.exiting(HttpStatus.OK.toString(), "Successful", Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED);
+ return loop;
+ }
+
+ /**
+ * Delete the operational policy.
+ *
+ * @param loopName the loop name
+ * @return the updated loop
+ * @throws Exceptions during the operation
+ */
+ public Loop deleteOpPolicy (Exchange camelExchange, String loopName) throws OperationException {
+ util.entering(request, "LoopOperation: delete guard policy");
+ Date startTime = new Date();
+ Loop loop = loopService.getLoop(loopName);
+
+ if (loop == null) {
+ String msg = "Delete guard policy 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);
+ }
+
+ // verify the current closed loop state
+ if (loop.getLastComputedState() != LoopState.SUBMITTED) {
+ String msg = "Delete MS policies exception: This closed loop is in state:" + loop.getLastComputedState()
+ + ". It could be deleted only when it is in SUBMITTED state.";
+ util.exiting(HttpStatus.CONFLICT.toString(), msg, Level.INFO,
+ ONAPLogConstants.ResponseStatus.ERROR);
+ throw new OperationException(msg);
+ }
+
+ // Establish the api call to Policy to delete operational policy
+ //client.deleteOpPolicy();
+
+ // audit log
+ LoggingUtils.setTimeContext(startTime, new Date());
+ auditLogger.info("Deletion of Guard policy completed");
+ util.exiting(HttpStatus.OK.toString(), "Successful", Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED);
+ return loop;
+ }
+
+ /**
+ * Delete the Guard policy.
+ *
+ * @param loopName the loop name
+ * @return the updated loop
+ * @throws Exceptions during the operation
+ */
+ public Loop deleteGuardPolicy (Exchange camelExchange, String loopName) throws OperationException {
+ util.entering(request, "LoopOperation: delete operational policy");
+ Date startTime = new Date();
+ Loop loop = loopService.getLoop(loopName);
+
+ if (loop == null) {
+ String msg = "Delete operational policy 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);
+ }
+
+ // verify the current closed loop state
+ if (loop.getLastComputedState() != LoopState.SUBMITTED) {
+ String msg = "Delete MS policies exception: This closed loop is in state:" + loop.getLastComputedState()
+ + ". It could be deleted only when it is in SUBMITTED state.";
+ util.exiting(HttpStatus.CONFLICT.toString(), msg, Level.INFO,
+ ONAPLogConstants.ResponseStatus.ERROR);
+ throw new OperationException(msg);
+ }
+
+ // Establish the api call to Policy to delete Guard policy
+ //client.deleteOpPolicy();
+
+ // audit log
+ LoggingUtils.setTimeContext(startTime, new Date());
+ auditLogger.info("Deletion of operational policy completed");
+ util.exiting(HttpStatus.OK.toString(), "Successful", Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED);
+ return loop;
+ }
}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.policy;
+
+import java.io.IOException;
+import java.util.Set;
+
+import org.onap.clamp.clds.config.ClampProperties;
+import org.onap.clamp.policy.microservice.MicroServicePolicy;
+import org.onap.clamp.util.HttpConnectionManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+
+@Component
+public class PolicyOperation {
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(PolicyOperation.class);
+ protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
+ public static final String POLICY_MSTYPE_PROPERTY_NAME = "policy.ms.type";
+ public static final String POLICY_ONAPNAME_PROPERTY_NAME = "policy.onap.name";
+ public static final String POLICY_BASENAME_PREFIX_PROPERTY_NAME = "policy.base.policyNamePrefix";
+ public static final String POLICY_OP_NAME_PREFIX_PROPERTY_NAME = "policy.op.policyNamePrefix";
+ public static final String POLICY_MS_NAME_PREFIX_PROPERTY_NAME = "policy.ms.policyNamePrefix";
+ public static final String POLICY_OP_TYPE_PROPERTY_NAME = "policy.op.type";
+ public static final String POLICY_GUARD_SUFFIX = "_Guard";
+ public static final String POLICY_URL_PROPERTY_NAME = "clamp.config.policy.url";
+ public static final String POLICY_URL_SUFFIX = "/versions/1.0.0/policies";
+ public static final String POLICY_USER_NAME = "clamp.config.policy.userName";
+ public static final String POLICY_PASSWORD = "clamp.config.policy.password";
+
+ public static final String TOSCA_DEF_VERSION = "tosca_definitions_version";
+ public static final String TOSCA_DEF_VERSION_VALUE = "tosca_simple_yaml_1_0_0";
+ public static final String TEMPLATE = "topology_template";
+ public static final String POLICIES = "policies";
+ public static final String MS_TYPE = "type";
+ public static final String MS_VERSION = "version";
+ public static final String MS_VERSION_VALUE = "1.0.0";
+ public static final String MS_METADATA = "metadata";
+ public static final String MS_POLICY_ID = "policy_id";
+ public static final String MS_PROPERTIES = "properties";
+ public static final String MS_policy = "tca_policy";
+
+ private final ClampProperties refProp;
+ private final HttpConnectionManager httpConnectionManager;
+
+ @Autowired
+ public PolicyOperation(ClampProperties refProp, HttpConnectionManager httpConnectionManager) {
+ this.refProp = refProp;
+ this.httpConnectionManager = httpConnectionManager;
+ }
+
+ public void createMsPolicy(Set<MicroServicePolicy> policyList) throws IOException {
+ // Get policy first? if exist delete???
+ // push pdp group
+ for (MicroServicePolicy msPolicy:policyList) {
+ JsonObject payload = createMsPolicyPayload(msPolicy);
+ String policyType = msPolicy.getModelType();
+ String url = refProp.getStringValue(POLICY_URL_PROPERTY_NAME) + policyType + POLICY_URL_SUFFIX;
+ String userName = refProp.getStringValue(POLICY_USER_NAME);
+ String encodedPass = refProp.getStringValue(POLICY_PASSWORD);
+ httpConnectionManager.doGeneralHttpQuery(url, "POST", payload.toString(), "application/json", "POLICY", userName, encodedPass);
+ }
+ }
+
+ public void deleteMsPolicy(Set<MicroServicePolicy> policyList) throws IOException {
+ for (MicroServicePolicy msPolicy:policyList) {
+ String policyType = msPolicy.getModelType();
+ String url = refProp.getStringValue(POLICY_URL_PROPERTY_NAME) + policyType + POLICY_URL_SUFFIX + "/" + msPolicy.getName();
+ String userName = refProp.getStringValue(POLICY_USER_NAME);
+ String encodedPass = refProp.getStringValue(POLICY_PASSWORD);
+ httpConnectionManager.doGeneralHttpQuery(url, "POST", null, null, "POLICY", userName, encodedPass);
+ }
+ }
+
+ private JsonObject createMsPolicyPayload(MicroServicePolicy microService) {
+ JsonObject policyConfig = new JsonObject();
+ policyConfig.add(MS_policy, microService.getProperties());
+
+ JsonObject properties = new JsonObject();
+ properties.add(MS_policy, policyConfig);
+
+ JsonObject msPolicy = new JsonObject();
+ msPolicy.addProperty(MS_TYPE, microService.getModelType());
+ msPolicy.addProperty(MS_VERSION, MS_VERSION_VALUE);
+ JsonObject metaData = new JsonObject();
+ metaData.addProperty(MS_POLICY_ID, microService.getName());
+ msPolicy.add(MS_METADATA, metaData);
+ msPolicy.add(MS_PROPERTIES, properties);
+
+ JsonObject msPolicyWithName = new JsonObject();
+ msPolicyWithName.add(microService.getName(), msPolicy);
+
+ JsonArray policyArray = new JsonArray();
+ policyArray.add(msPolicyWithName);
+
+ JsonObject template = new JsonObject();
+ template.add(POLICIES, policyArray);
+
+ JsonObject configPolicy = new JsonObject();
+ configPolicy.addProperty(TOSCA_DEF_VERSION, TOSCA_DEF_VERSION_VALUE);
+ configPolicy.add(TEMPLATE, template);
+
+ return configPolicy;
+ }
+
+}
@Column(nullable = false, name = "name", unique = true)
private String name;
+ @Expose
+ @Column(nullable = false, name = "model_type")
+ private String modelType;
+
+ @Expose
+ @Column(nullable = false, name = "blueprint_name")
+ private String blueprintName;
+
@Expose
@Type(type = "json")
@Column(columnDefinition = "json", name = "properties")
/**
* The constructor.
* @param name The name of the MicroService
+ * @param type The model type of the MicroService
+ * @param blueprintName The name in the blueprint
* @param policyTosca The policy Tosca of the MicroService
* @param shared The flag indicate whether the MicroService is shared
* @param usedByLoops The list of loops that uses this MicroService
*/
- public MicroServicePolicy(String name, String policyTosca, Boolean shared, Set<Loop> usedByLoops) {
+ public MicroServicePolicy(String name, String modelType, String policyTosca, Boolean shared, Set<Loop> usedByLoops, String blueprintName) {
this.name = name;
+ this.modelType = modelType;
this.policyTosca = policyTosca;
this.shared = shared;
this.jsonRepresentation = JsonUtils.GSON_JPA_MODEL
.fromJson(new ToscaYamlToJsonConvertor(null).parseToscaYaml(policyTosca), JsonObject.class);
this.usedByLoops = usedByLoops;
+ this.blueprintName = blueprintName;
}
/**
* The constructor.
* @param name The name of the MicroService
+ * @param type The model type of the MicroService
+ * @param blueprintName The name in the blueprint
* @param policyTosca The policy Tosca of the MicroService
* @param shared The flag indicate whether the MicroService is shared
* @param jsonRepresentation The UI representation in json format
* @param usedByLoops The list of loops that uses this MicroService
*/
- public MicroServicePolicy(String name, String policyTosca, Boolean shared, JsonObject jsonRepresentation,
- Set<Loop> usedByLoops) {
+ public MicroServicePolicy(String name, String modelType, String policyTosca, Boolean shared, JsonObject jsonRepresentation,
+ Set<Loop> usedByLoops, String blueprintName) {
this.name = name;
+ this.modelType = modelType;
this.policyTosca = policyTosca;
this.shared = shared;
this.usedByLoops = usedByLoops;
this.jsonRepresentation = jsonRepresentation;
+ this.blueprintName = blueprintName;
}
@Override
return name;
}
+ public String getModelType() {
+ return modelType;
+ }
+
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
public JsonObject getProperties() {
return properties;
}
@Transactional
public MicroServicePolicy getAndUpdateMicroServicePolicy(Loop loop, MicroServicePolicy policy) {
return repository.findById(policy.getName()).map(p -> updateMicroservicePolicyProperties(p, policy, loop))
- .orElse(new MicroServicePolicy(policy.getName(), policy.getPolicyTosca(), policy.getShared(),
- policy.getJsonRepresentation(), Sets.newHashSet(loop)));
+ .orElse(new MicroServicePolicy(policy.getName(), policy.getModelType(), policy.getPolicyTosca(), policy.getShared(),
+ policy.getJsonRepresentation(), Sets.newHashSet(loop), policy.getBlueprintName()));
}
private MicroServicePolicy updateMicroservicePolicyProperties(MicroServicePolicy oldPolicy,
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
+import sun.misc.BASE64Encoder;
+
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
+import java.security.GeneralSecurityException;
import javax.net.ssl.HttpsURLConnection;
import javax.ws.rs.BadRequestException;
+import org.apache.commons.codec.DecoderException;
import org.apache.commons.io.IOUtils;
+import org.onap.clamp.clds.util.CryptoUtils;
import org.onap.clamp.clds.util.LoggingUtils;
import org.springframework.stereotype.Component;
protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
private static final String REQUEST_FAILED_LOG = "Request Failed - response payload=";
- private String doHttpsQuery(URL url, String requestMethod, String payload, String contentType, String target) throws IOException {
+ private String doHttpsQuery(URL url, String requestMethod, String payload, String contentType, String target, String userName, String password) throws IOException {
LoggingUtils utils = new LoggingUtils(logger);
logger.info("Using HTTPS URL:" + url.toString());
HttpsURLConnection secureConnection = (HttpsURLConnection) url.openConnection();
secureConnection = utils.invokeHttps(secureConnection, target, requestMethod);
secureConnection.setRequestMethod(requestMethod);
- secureConnection.setRequestProperty("X-ECOMP-RequestID", LoggingUtils.getRequestId());
+ if (userName != null && password != null) {
+ secureConnection.setRequestProperty("Authorization", "Basic " + generateBasicAuth(userName, password));
+ }
if (payload != null && contentType != null) {
secureConnection.setRequestProperty("Content-Type", contentType);
secureConnection.setDoOutput(true);
}
}
- private String doHttpQuery(URL url, String requestMethod, String payload, String contentType, String target) throws IOException {
+ private String doHttpQuery(URL url, String requestMethod, String payload, String contentType, String target, String userName, String password) throws IOException {
LoggingUtils utils = new LoggingUtils(logger);
logger.info("Using HTTP URL:" + url);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection = utils.invoke(connection, target, requestMethod);
connection.setRequestMethod(requestMethod);
+ if (userName != null && password != null) {
+ connection.setRequestProperty("Authorization", "Basic " + generateBasicAuth(userName, password));
+ }
if (payload != null && contentType != null) {
connection.setRequestProperty("Content-Type", contentType);
connection.setDoOutput(true);
* @throws IOException
* In case of issue with the streams
*/
- public String doGeneralHttpQuery(String url, String requestMethod, String payload, String contentType, String target)
+ public String doGeneralHttpQuery(String url, String requestMethod, String payload, String contentType, String target, String userName, String password)
throws IOException {
URL urlObj = new URL(url);
if (url.contains("https://")) { // Support for HTTPS
- return doHttpsQuery(urlObj, requestMethod, payload, contentType, target);
+ return doHttpsQuery(urlObj, requestMethod, payload, contentType, target, userName, password);
} else { // Support for HTTP
- return doHttpQuery(urlObj, requestMethod, payload, contentType, target);
+ return doHttpQuery(urlObj, requestMethod, payload, contentType, target, userName, password);
+ }
+ }
+
+ private String generateBasicAuth(String userName, String encodedPassword) {
+ String password = "";
+ try {
+ password = CryptoUtils.decrypt(encodedPassword);
+ } catch (GeneralSecurityException e) {
+ logger.error("Unable to decrypt the password", e);
+ } catch (DecoderException e) {
+ logger.error("Exception caught when decoding the HEX String Key for encryption", e);
}
+ BASE64Encoder enc = new sun.misc.BASE64Encoder();
+ String userpassword = userName + ":" + password;
+ return enc.encode( userpassword.getBytes() );
}
}
var def = $q.defer();
var sets = [];
var svcAction = uiAction.toLowerCase();
- var svcUrl = "/restservices/clds/v2/loop/" + "action/" + svcAction + "/" + modelName;
+ var svcUrl = "/restservices/clds/v2/loop/" + svcAction + "/" + modelName;
$http.put(svcUrl).success(
function(data) {
#
#
# Configuration Settings for Policy Engine Components
+clamp.config.policy.url=http://localhost:8085/
+clamp.config.policy.userName=test
+clamp.config.policy.password=test
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
#
#
# Configuration Settings for Policy Engine Components
+clamp.config.policy.url=http://policy.api.simpledemo.onap.org:8081/pdp/
+clamp.config.policy.userName=test
+clamp.config.policy.password=test
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
<to uri="bean:org.onap.clamp.operation.LoopOperation?method=unDeployLoop(${header.loopName})" />
</route>
</put>
+ <put uri="/v2/loop/submit/{loopName}">
+ <route>
+ <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to uri="bean:org.onap.clamp.operation.LoopOperation?method=submitMsPolicies(${header.loopName})" />
+ <!-- <to uri="bean:org.onap.clamp.operation.LoopOperation?method=submitOpPolicy(${header.loopName})" />-->
+ <!--<to uri="bean:org.onap.clamp.operation.LoopOperation?method=submitGuardPolicy(${header.loopName})" /> -->
+ </route>
+ </put>
+ <put uri="/v2/loop/delete/{loopName}"
+ outType="org.onap.clamp.loop.Loop"
+ produces="application/json">
+ <route>
+ <to uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to uri="bean:org.onap.clamp.operation.LoopOperation?method=deleteMsPolicies(${header.loopName})" />
+ <to uri="bean:org.onap.clamp.operation.LoopOperation?method=deleteOpPolicy(${header.loopName})" />
+ <to uri="bean:org.onap.clamp.operation.LoopOperation?method=deleteGuardPolicy(${header.loopName})" />
+ </route>
+ </put>
</rest>
</rests>
@Test
public void shouldReturnDcaeOperationSataus() throws IOException {
//given
- Mockito.when(httpConnectionManager.doGeneralHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null, "DCAE"))
+ Mockito.when(httpConnectionManager.doGeneralHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null, "DCAE", null, null))
.thenReturn(STATUS_RESPONSE_PROCESSING);
//when
String operationStatus = dcaeDispatcherServices.getOperationStatus(DEPLOYMENT_STATUS_URL);
public void shouldTryMultipleTimesWhenProcessing() throws IOException, InterruptedException {
//given
Mockito.when(httpConnectionManager.doGeneralHttpQuery(DEPLOYMENT_STATUS_URL, "GET",
- null, null, "DCAE"))
+ null, null, "DCAE", null, null))
.thenReturn(STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_ACTIVE);
//when
String operationStatus = dcaeDispatcherServices.getOperationStatusWithRetry(DEPLOYMENT_STATUS_URL);
//then
Assertions.assertThat(operationStatus).isEqualTo("succeeded");
Mockito.verify(httpConnectionManager, Mockito.times(3))
- .doGeneralHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null, "DCAE");
+ .doGeneralHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null, "DCAE", null, null);
}
public void shouldTryOnlyAsManyTimesAsConfigured() throws IOException, InterruptedException {
//given
Mockito.when(httpConnectionManager
- .doGeneralHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null, "DCAE"))
+ .doGeneralHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null, "DCAE", null, null))
.thenReturn(STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_PROCESSING,
STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_PROCESSING);
//when
//then
Assertions.assertThat(operationStatus).isEqualTo("processing");
Mockito.verify(httpConnectionManager, Mockito.times(3))
- .doGeneralHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null, "DCAE");
+ .doGeneralHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null, "DCAE", null, null);
}
+ "/dcae-deployments/closedLoop_152367c8-b172-47b3-9e58-c53add75d869_deploymentId",
"PUT",
"{\"serviceTypeId\":\"e2ba40f7-bf42-41e7-acd7-48fd07586d90\",\"inputs\":{}}",
- "application/json", "DCAE"))
+ "application/json", "DCAE", null, null))
.thenReturn(DEPLOY_RESPONSE_STRING);
JsonObject blueprintInputJson = new JsonObject();
@Test
public void testHttpGet() throws Exception {
String response = httpConnectionManager
- .doGeneralHttpQuery("http://localhost:" + this.httpPort + "/designer/index.html", "GET", null, null, "DCAE");
+ .doGeneralHttpQuery("http://localhost:" + this.httpPort + "/designer/index.html", "GET", null, null, "DCAE", null, null);
assertNotNull(response);
// Should be a redirection so 302, so empty
assertTrue(response.isEmpty());
@Test
public void testHttpsGet() throws Exception {
String response = httpConnectionManager
- .doGeneralHttpQuery("https://localhost:" + this.httpsPort + "/designer/index.html", "GET", null, null, "DCAE");
+ .doGeneralHttpQuery("https://localhost:" + this.httpsPort + "/designer/index.html", "GET", null, null, "DCAE", null, null);
assertNotNull(response);
// Should contain something
assertTrue(!response.isEmpty());
@Test(expected = BadRequestException.class)
public void testHttpsGet404() throws IOException {
httpConnectionManager.doGeneralHttpQuery("https://localhost:" + this.httpsPort + "/designer/index1.html",
- "GET", null, null, "DCAE");
+ "GET", null, null, "DCAE", null, null);
fail("Should have raised an BadRequestException");
}
@Test(expected = BadRequestException.class)
public void testHttpsPost404() throws IOException {
httpConnectionManager.doGeneralHttpQuery("https://localhost:" + this.httpsPort + "/designer/index1.html",
- "POST", "", "application/json", "DCAE");
+ "POST", "", "application/json", "DCAE", null, null);
fail("Should have raised an BadRequestException");
}
@Test(expected = BadRequestException.class)
public void testHttpException() throws IOException {
httpConnectionManager.doGeneralHttpQuery("http://localhost:" + this.httpsPort + "/designer/index.html", "GET",
- null, null, "DCAE");
+ null, null, "DCAE", null, null);
fail("Should have raised an BadRequestException");
}
}
private static final String FIRST_APPP = "first_app";
private static final String SECOND_APPP = "second_app";
private static final String THIRD_APPP = "third_app";
+ private static final String MODEL_TYPE1 = "type1";
+ private static final String MODEL_TYPE2 = "type2";
+ private static final String MODEL_TYPE3 = "type3";
private static String microServiceTheWholeBlueprintValid;
private static String microServiceBlueprintOldStyleTCA;
public void getNodeRepresentationFromCompleteYaml() {
final JsonObject jsonObject = jsonObjectBlueprintValid;
- MicroService expected = new MicroService(SECOND_APPP, FIRST_APPP, "");
+ MicroService expected = new MicroService(SECOND_APPP, MODEL_TYPE1, FIRST_APPP, "", SECOND_APPP);
Entry<String, JsonElement> entry = jsonObject.entrySet().iterator().next();
MicroService actual = new BlueprintParser().getNodeRepresentation(entry);
@Test
public void getMicroServicesFromBlueprintTest() {
- MicroService thirdApp = new MicroService(THIRD_APPP, "", "");
- MicroService firstApp = new MicroService(FIRST_APPP, THIRD_APPP, "");
- MicroService secondApp = new MicroService(SECOND_APPP, FIRST_APPP, "");
+ MicroService thirdApp = new MicroService(THIRD_APPP, MODEL_TYPE3, "", "", THIRD_APPP);
+ MicroService firstApp = new MicroService(FIRST_APPP, MODEL_TYPE1, THIRD_APPP, "", FIRST_APPP);
+ MicroService secondApp = new MicroService(SECOND_APPP, MODEL_TYPE2, FIRST_APPP, "", SECOND_APPP);
Set<MicroService> expected = new HashSet<>(Arrays.asList(firstApp, secondApp, thirdApp));
Set<MicroService> actual = new BlueprintParser().getMicroServices(microServiceTheWholeBlueprintValid);
@Test
public void fallBackToOneMicroServiceTCATest() {
- MicroService tcaMS = new MicroService(BlueprintParser.TCA, "", "");
+ MicroService tcaMS = new MicroService(BlueprintParser.TCA, "", "", "", "");
List<MicroService> expected = Collections.singletonList(tcaMS);
List<MicroService> actual = new BlueprintParser().fallbackToOneMicroService(microServiceBlueprintOldStyleTCA);
@Test
public void fallBackToOneMicroServiceHolmesTest() {
- MicroService holmesMS = new MicroService(BlueprintParser.HOLMES, "", "");
+ MicroService holmesMS = new MicroService(BlueprintParser.HOLMES, "", "", "", "");
List<MicroService> expected = Collections.singletonList(holmesMS);
List<MicroService> actual = new BlueprintParser()
@Test
public void getChainOfMicroServicesTest() {
- MicroService ms1 = new MicroService(FIRST_APPP, "", "");
- MicroService ms2 = new MicroService(SECOND_APPP, FIRST_APPP, "");
- MicroService ms3 = new MicroService(THIRD_APPP, SECOND_APPP, "");
- MicroService ms4 = new MicroService(FOURTH_APPP, THIRD_APPP, "");
+ MicroService ms1 = new MicroService(FIRST_APPP, "", "", "", "");
+ MicroService ms2 = new MicroService(SECOND_APPP, "", FIRST_APPP, "", "");
+ MicroService ms3 = new MicroService(THIRD_APPP, "", SECOND_APPP, "", "");
+ MicroService ms4 = new MicroService(FOURTH_APPP, "", THIRD_APPP, "", "");
List<MicroService> expectedList = Arrays.asList(ms1, ms2, ms3, ms4);
Set<MicroService> inputSet = new HashSet<>(expectedList);
@Test
public void getChainOfMicroServicesTwiceNoInputTest() {
- MicroService ms1 = new MicroService(FIRST_APPP, "", "");
- MicroService ms2 = new MicroService(SECOND_APPP, "", "");
- MicroService ms3 = new MicroService(THIRD_APPP, SECOND_APPP, "");
- MicroService ms4 = new MicroService(FOURTH_APPP, FIRST_APPP, "");
+ MicroService ms1 = new MicroService(FIRST_APPP, "", "", "", "");
+ MicroService ms2 = new MicroService(SECOND_APPP, "", "", "", "");
+ MicroService ms3 = new MicroService(THIRD_APPP, "", SECOND_APPP, "", "");
+ MicroService ms4 = new MicroService(FOURTH_APPP, "", FIRST_APPP, "", "");
Set<MicroService> inputSet = new HashSet<>(Arrays.asList(ms1, ms2, ms3, ms4));
List<MicroService> actualList = new ChainGenerator().getChainOfMicroServices(inputSet);
@Test
public void getChainOfMicroServicesBranchingTest() {
- MicroService ms1 = new MicroService(FIRST_APPP, "", "");
- MicroService ms2 = new MicroService(SECOND_APPP, FIRST_APPP, "");
- MicroService ms3 = new MicroService(THIRD_APPP, FIRST_APPP, "");
- MicroService ms4 = new MicroService(FOURTH_APPP, FIRST_APPP, "");
+ MicroService ms1 = new MicroService(FIRST_APPP, "", "", "", "");
+ MicroService ms2 = new MicroService(SECOND_APPP, "", FIRST_APPP, "", "");
+ MicroService ms3 = new MicroService(THIRD_APPP, "", FIRST_APPP, "", "");
+ MicroService ms4 = new MicroService(FOURTH_APPP, "", FIRST_APPP, "", "");
Set<MicroService> inputSet = new HashSet<>(Arrays.asList(ms1, ms2, ms3, ms4));
List<MicroService> actualList = new ChainGenerator().getChainOfMicroServices(inputSet);
@Test
public void clampGraphBuilderCompleteChainTest() {
String collector = "VES";
- MicroService ms1 = new MicroService("ms1", "", "ms1_jpa_id");
- MicroService ms2 = new MicroService("ms2", "", "ms2_jpa_id");
+ MicroService ms1 = new MicroService("ms1", "", "", "ms1_jpa_id", "");
+ MicroService ms2 = new MicroService("ms2", "", "", "ms2_jpa_id", "");
;
String policy = "Policy";
List<MicroService> microServices = Arrays.asList(ms1, ms2);
@Test(expected = InvalidStateException.class)
public void clampGraphBuilderNoPolicyGivenTest() {
String collector = "VES";
- MicroService ms1 = new MicroService("ms1", "", "ms1_jpa_id");
- MicroService ms2 = new MicroService("ms2", "", "ms2_jpa_id");
+ MicroService ms1 = new MicroService("ms1", "", "", "ms1_jpa_id", "");
+ MicroService ms2 = new MicroService("ms2", "", "", "ms2_jpa_id", "");
ClampGraphBuilder clampGraphBuilder = new ClampGraphBuilder(mockPainter);
clampGraphBuilder.collector(collector).addMicroService(ms1).addMicroService(ms2).build();
assertThat(loop.getSvgRepresentation()).startsWith("<svg ");
assertThat(loop.getGlobalPropertiesJson().get("dcaeDeployParameters")).isNotNull();
assertThat(loop.getMicroServicePolicies()).hasSize(1);
-
assertThat(loop.getOperationalPolicies()).hasSize(1);
assertThat(loop.getModelPropertiesJson().get("serviceDetails")).isNotNull();
assertThat(loop.getModelPropertiesJson().get("resourceDetails")).isNotNull();
return loop;
}
- private MicroServicePolicy getMicroServicePolicy(String name, String jsonRepresentation, String policyTosca,
+ private MicroServicePolicy getMicroServicePolicy(String name, String modelType, String jsonRepresentation, String policyTosca,
String jsonProperties, boolean shared) {
- MicroServicePolicy µService = new MicroServicePolicy(name, policyTosca, shared,
- gson.fromJson(jsonRepresentation, JsonObject.class), new HashSet<>());
+ MicroServicePolicy µService = new MicroServicePolicy(name, modelType, policyTosca, shared,
+ gson.fromJson(jsonRepresentation, JsonObject.class), new HashSet<>(), "");
µService.setProperties(new Gson().fromJson(jsonProperties, JsonObject.class));
return µService;
}
"123456789", "https://dcaetest.org", "UUID-blueprint");
OperationalPolicy opPolicy = this.getOperationalPolicy("{\"type\":\"GUARD\"}", "GuardOpPolicyTest");
loopTest.addOperationalPolicy(opPolicy);
- MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "{\"configtype\":\"json\"}",
+ MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "", "{\"configtype\":\"json\"}",
"YamlContent", "{\"param1\":\"value1\"}", true);
loopTest.addMicroServicePolicy(microServicePolicy);
LoopLog loopLog = getLoopLog(LogType.INFO, "test message");
JsonObject confJson = JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class);
String policyName = "policyName";
String policyTosca = "policyTosca";
- MicroServicePolicy microServicePolicy = new MicroServicePolicy(policyName, policyTosca, false, confJson, null);
+ MicroServicePolicy microServicePolicy = new MicroServicePolicy(policyName, "", policyTosca, false, confJson, null, "");
//when
Loop actualLoop = loopService
JsonObject newJsonRepresentation = JsonUtils.GSON.fromJson("{}", JsonObject.class);
String secondPolicyName = "secondPolicyName";
String secondPolicyTosca = "secondPolicyTosca";
- MicroServicePolicy firstMicroServicePolicy = new MicroServicePolicy(firstPolicyName, "policyTosca",
- false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ MicroServicePolicy firstMicroServicePolicy = new MicroServicePolicy(firstPolicyName, "", "policyTosca",
+ false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, "");
loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(firstMicroServicePolicy));
- MicroServicePolicy secondMicroServicePolicy = new MicroServicePolicy(secondPolicyName, secondPolicyTosca, true,
- newJsonRepresentation, null);
+ MicroServicePolicy secondMicroServicePolicy = new MicroServicePolicy(secondPolicyName, "", secondPolicyTosca, true,
+ newJsonRepresentation, null, "");
//when
firstMicroServicePolicy.setProperties(JsonUtils.GSON.fromJson("{\"name1\":\"value1\"}", JsonObject.class));
String firstPolicyName = "firstPolicyName";
String secondPolicyName = "policyName";
String secondPolicyTosca = "secondPolicyTosca";
- MicroServicePolicy firstMicroServicePolicy = new MicroServicePolicy(firstPolicyName, "policyTosca",
- false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ MicroServicePolicy firstMicroServicePolicy = new MicroServicePolicy(firstPolicyName, "", "policyTosca",
+ false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, "");
loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(firstMicroServicePolicy));
- MicroServicePolicy secondMicroServicePolicy = new MicroServicePolicy(secondPolicyName, secondPolicyTosca, true,
- jsonRepresentation, null);
+ MicroServicePolicy secondMicroServicePolicy = new MicroServicePolicy(secondPolicyName, "", secondPolicyTosca, true,
+ jsonRepresentation, null, "");
//when
Loop actualLoop = loopService
return loop;
}
- private MicroServicePolicy getMicroServicePolicy(String name, String jsonRepresentation, String policyTosca,
+ private MicroServicePolicy getMicroServicePolicy(String name, String modelType, String jsonRepresentation, String policyTosca,
String jsonProperties, boolean shared) {
- MicroServicePolicy µService = new MicroServicePolicy(name, policyTosca, shared,
- gson.fromJson(jsonRepresentation, JsonObject.class), new HashSet<>());
+ MicroServicePolicy µService = new MicroServicePolicy(name, modelType, policyTosca, shared,
+ gson.fromJson(jsonRepresentation, JsonObject.class), new HashSet<>(), "");
µService.setProperties(new Gson().fromJson(jsonProperties, JsonObject.class));
return µService;
"123456789", "https://dcaetest.org", "UUID-blueprint");
OperationalPolicy opPolicy = this.getOperationalPolicy("{\"type\":\"GUARD\"}", "GuardOpPolicyTest");
loopTest.addOperationalPolicy(opPolicy);
- MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "{\"configtype\":\"json\"}",
+ MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "", "{\"configtype\":\"json\"}",
"YamlContent", "{\"param1\":\"value1\"}", true);
loopTest.addMicroServicePolicy(microServicePolicy);
LoopLog loopLog = getLoopLog(LogType.INFO, "test message");
#\r
#\r
# Configuration Settings for Policy Engine Components\r
+clamp.config.policy.url=http://localhost:${docker.http-cache.port.host}\r
+clamp.config.policy.userName=test\r
+clamp.config.policy.password=test\r
clamp.config.policy.pdpUrl1=http://localhost:${docker.http-cache.port.host}/pdp/ , testpdp, alpha123\r
clamp.config.policy.pdpUrl2=http://localhost:${docker.http-cache.port.host}/pdp/ , testpdp, alpha123\r
clamp.config.policy.papUrl=http://localhost:${docker.http-cache.port.host}/pap/ , testpap, alpha123\r
service_component_type: dcaegen2-analytics-tca
service_component_name_override: second_app
image: { get_input: second_app_docker_image }
+ policy_id:
+ policy_type_id: type2
interfaces:
cloudify.interfaces.lifecycle:
start:
dns_name: "first_app"
image: { get_input: first_app_docker_image }
container_port: 6565
+ policy_id:
+ policy_type_id: type1
interfaces:
cloudify.interfaces.lifecycle:
start:
dns_name: "third_app"
image: { get_input: third_app_docker_image }
container_port: 443
+ policy_id:
+ policy_type_id: type3
interfaces:
cloudify.interfaces.lifecycle:
start:
service_component_name_override: second_app
image: { get_input: second_app_docker_image }
name: second_app
+ policy_id:
+ policy_type_id: type1
interfaces:
cloudify.interfaces.lifecycle:
start: