summaryrefslogtreecommitdiffstats
path: root/applications/guard/src/main
diff options
context:
space:
mode:
authorpramod.jamkhedkar <pramod@research.att.com>2020-02-27 12:55:59 -0500
committerpramod.jamkhedkar <pramod@research.att.com>2020-02-28 11:47:41 -0500
commit501ee00e742a6f56a16ace66f4a64eb7ec9e854b (patch)
treeb7655a4f7b26c08741b24d088b9533c73dab6484 /applications/guard/src/main
parentfcd767926048397607d9e0f0288f2a0982f6bbcc (diff)
XACML pdp support for clc.
Added policies for SON and PCI to support each blocking the other, with test cases and appropriate requests Issue-ID: POLICY-2163 Change-Id: I8153f9cd973a7cd6824fcd6c9787628a74148d46 Signed-off-by: pramod.jamkhedkar <pramod@research.att.com>
Diffstat (limited to 'applications/guard/src/main')
-rw-r--r--applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java25
1 files changed, 18 insertions, 7 deletions
diff --git a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java
index eb86486d..60fac498 100644
--- a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java
+++ b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -94,12 +94,20 @@ public class CoordinationGuardTranslator implements ToscaPolicyTranslator {
}
}
+ /**
+ * This function is not used for CLC instead
+ * the one in LegacyGuardTranslator is used.
+ */
@Override
public Request convertRequest(DecisionRequest request) {
LOGGER.info("this convertRequest shouldn't be used");
return null;
}
+ /**
+ * This function is not used for CLC instead
+ * the one in LegacyGuardTranslator is used.
+ */
@Override
public DecisionResponse convertResponse(Response xacmlResponse) {
LOGGER.info("this convertResponse shouldn't be used");
@@ -112,13 +120,15 @@ public class CoordinationGuardTranslator implements ToscaPolicyTranslator {
* @param directiveFilename yaml directive file to load
* @return the CoordinationDirective
*/
- public static CoordinationDirective loadCoordinationDirectiveFromFile(String directiveFilename) {
+ public static CoordinationDirective loadCoordinationDirectiveFromFile(
+ String directiveFilename) {
try (InputStream is = new FileInputStream(new File(directiveFilename))) {
String contents = IOUtils.toString(is, StandardCharsets.UTF_8);
//
// Read the yaml into our Java Object
//
- CoordinationDirective obj = new StandardYamlCoder().decode(contents, CoordinationDirective.class);
+ CoordinationDirective obj =
+ new StandardYamlCoder().decode(contents, CoordinationDirective.class);
LOGGER.debug(contents);
return obj;
} catch (IOException | CoderException e) {
@@ -135,11 +145,12 @@ public class CoordinationGuardTranslator implements ToscaPolicyTranslator {
* @return the generated Xacml policy
*/
public static String generateXacmlFromCoordinationDirective(CoordinationDirective cd,
- String protoDir) throws ToscaPolicyConversionException {
+ String protoDir) throws ToscaPolicyConversionException {
/*
* Determine file names
*/
- String xacmlProtoFilename = protoDir + File.separator + cd.getCoordinationFunction() + ".xml";
+ String xacmlProtoFilename =
+ protoDir + File.separator + cd.getCoordinationFunction() + ".xml";
LOGGER.debug("xacmlProtoFilename={}", xacmlProtoFilename);
/*
* Values to be used for placeholders
@@ -156,8 +167,8 @@ public class CoordinationGuardTranslator implements ToscaPolicyTranslator {
.map(s -> s.replace("CONTROL_LOOP_TWO", cLTwo))
.collect(Collectors.joining(XacmlPolicyUtils.LINE_SEPARATOR));
} catch (IOException e) {
- throw new
- ToscaPolicyConversionException("Error while generating XACML policy for coordination directive", e);
+ throw new ToscaPolicyConversionException(
+ "Error while generating XACML policy for coordination directive", e);
}
}