A lot of debug should really be info for logs. To assist
with debugging but also really need to be there for auditing.
Issue-ID: POLICY-1730
Change-Id: I5c41e056775c24797d257504e9c6495fa3127e45
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
*/
public OnapPolicyFinderFactory(Properties properties) {
super(properties);
*/
public OnapPolicyFinderFactory(Properties properties) {
super(properties);
- logger.debug("Constructed using properties {}", properties);
+ logger.info("Constructed using properties {}", properties);
//
// Save our properties
//
//
// Save our properties
//
protected synchronized void init() {
if (this.needsInit) {
protected synchronized void init() {
if (this.needsInit) {
- logger.debug("Initializing OnapPolicyFinderFactory Properties ");
+ logger.info("Initializing OnapPolicyFinderFactory Properties ");
//
// Check for property that combines root policies into one policyset
//
// Check for property that combines root policies into one policyset
this.rootPolicies = this.getPolicyDefs(XACMLProperties.PROP_ROOTPOLICIES);
}
this.referencedPolicies = this.getPolicyDefs(XACMLProperties.PROP_REFERENCEDPOLICIES);
this.rootPolicies = this.getPolicyDefs(XACMLProperties.PROP_ROOTPOLICIES);
}
this.referencedPolicies = this.getPolicyDefs(XACMLProperties.PROP_REFERENCEDPOLICIES);
- logger.debug("Root Policies: {}", this.rootPolicies.size());
- logger.debug("Referenced Policies: {}", this.referencedPolicies.size());
+ logger.info("Root Policies: {}", this.rootPolicies.size());
+ logger.info("Referenced Policies: {}", this.referencedPolicies.size());
this.needsInit = false;
}
}
this.needsInit = false;
}
}
* @throws IOException If unable to read file
*/
public static Properties loadXacmlProperties(Path propertyPath) throws IOException {
* @throws IOException If unable to read file
*/
public static Properties loadXacmlProperties(Path propertyPath) throws IOException {
- LOGGER.debug("Loading xacml properties {}", propertyPath);
+ LOGGER.info("Loading xacml properties {}", propertyPath);
try (InputStream is = Files.newInputStream(propertyPath)) {
Properties properties = new Properties();
properties.load(is);
try (InputStream is = Files.newInputStream(propertyPath)) {
Properties properties = new Properties();
properties.load(is);
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Loaded xacml properties {} {}", System.lineSeparator(), properties);
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Loaded xacml properties {} {}", System.lineSeparator(), properties);
for (Entry<Object, Object> entrySet : properties.entrySet()) {
for (Entry<Object, Object> entrySet : properties.entrySet()) {
- LOGGER.debug("{} -> {}", entrySet.getKey(), entrySet.getValue());
+ LOGGER.info("{} -> {}", entrySet.getKey(), entrySet.getValue());
* @throws IOException If unable to store the file.
*/
public static void storeXacmlProperties(Properties properties, Path propertyPath) throws IOException {
* @throws IOException If unable to store the file.
*/
public static void storeXacmlProperties(Properties properties, Path propertyPath) throws IOException {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Storing xacml properties {} {} {}", properties, System.lineSeparator(), propertyPath);
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Storing xacml properties {} {} {}", properties, System.lineSeparator(), propertyPath);
}
try (OutputStream os = Files.newOutputStream(propertyPath)) {
String strComments = "#";
}
try (OutputStream os = Files.newOutputStream(propertyPath)) {
String strComments = "#";
// Get a file
//
Path rootPath = Paths.get(properties.getProperty(root + DOT_FILE_SUFFIX));
// Get a file
//
Path rootPath = Paths.get(properties.getProperty(root + DOT_FILE_SUFFIX));
- LOGGER.debug("Root file {} {}", rootPath, rootPath.getFileName());
+ LOGGER.info("Root file {} {}", rootPath, rootPath.getFileName());
//
// Construct new path for the root policy
//
//
// Construct new path for the root policy
//
// Get a file
//
Path refPath = Paths.get(properties.getProperty(referenced + DOT_FILE_SUFFIX));
// Get a file
//
Path refPath = Paths.get(properties.getProperty(referenced + DOT_FILE_SUFFIX));
- LOGGER.debug("Referenced file {} {}", refPath, refPath.getFileName());
+ LOGGER.info("Referenced file {} {}", refPath, refPath.getFileName());
//
// Construct new path for the root policy
//
//
// Construct new path for the root policy
//
@Override
public Request convertRequest(DecisionRequest request) {
@Override
public Request convertRequest(DecisionRequest request) {
- LOGGER.debug("Converting Request {}", request);
+ LOGGER.info("Converting Request {}", request);
try {
return RequestParser.parseRequest(StdCombinedPolicyRequest.createInstance(request));
} catch (IllegalArgumentException | IllegalAccessException | DataTypeException e) {
try {
return RequestParser.parseRequest(StdCombinedPolicyRequest.createInstance(request));
} catch (IllegalArgumentException | IllegalAccessException | DataTypeException e) {
protected void scanObligations(Collection<Obligation> obligations, DecisionResponse decisionResponse) {
for (Obligation obligation : obligations) {
protected void scanObligations(Collection<Obligation> obligations, DecisionResponse decisionResponse) {
for (Obligation obligation : obligations) {
- LOGGER.debug("Obligation: {}", obligation);
+ LOGGER.info("Obligation: {}", obligation);
for (AttributeAssignment assignment : obligation.getAttributeAssignments()) {
for (AttributeAssignment assignment : obligation.getAttributeAssignments()) {
- LOGGER.debug("Attribute Assignment: {}", assignment);
+ LOGGER.info("Attribute Assignment: {}", assignment);
//
// We care about the content attribute
//
//
// We care about the content attribute
//
// The contents are in Json form
//
Object stringContents = assignment.getAttributeValue().getValue();
// The contents are in Json form
//
Object stringContents = assignment.getAttributeValue().getValue();
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("DCAE contents: {}{}", System.lineSeparator(), stringContents);
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("DCAE contents: {}{}", System.lineSeparator(), stringContents);
}
//
// Let's parse it into a map using Gson
}
//
// Let's parse it into a map using Gson
//
// Convert the YAML Policy to JSON Object
//
//
// Convert the YAML Policy to JSON Object
//
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("JSON DCAE Policy {}{}", System.lineSeparator(), jsonPolicy);
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("JSON DCAE Policy {}{}", System.lineSeparator(), jsonPolicy);
}
//
// Create an AttributeValue for it
}
//
// Create an AttributeValue for it
@Override
public Request convertRequest(DecisionRequest request) {
@Override
public Request convertRequest(DecisionRequest request) {
- LOGGER.debug("Converting Request {}", request);
+ LOGGER.info("Converting Request {}", request);
try {
return RequestParser.parseRequest(StdMatchablePolicyRequest.createInstance(request));
} catch (IllegalArgumentException | IllegalAccessException | DataTypeException e) {
try {
return RequestParser.parseRequest(StdMatchablePolicyRequest.createInstance(request));
} catch (IllegalArgumentException | IllegalAccessException | DataTypeException e) {
@Override
public DecisionResponse convertResponse(Response xacmlResponse) {
@Override
public DecisionResponse convertResponse(Response xacmlResponse) {
- LOGGER.debug("Converting Response {}", xacmlResponse);
+ LOGGER.info("Converting Response {}", xacmlResponse);
DecisionResponse decisionResponse = new DecisionResponse();
//
// Setup policies
DecisionResponse decisionResponse = new DecisionResponse();
//
// Setup policies
protected void scanObligations(Collection<Obligation> obligations, DecisionResponse decisionResponse) {
for (Obligation obligation : obligations) {
protected void scanObligations(Collection<Obligation> obligations, DecisionResponse decisionResponse) {
for (Obligation obligation : obligations) {
- LOGGER.debug("Obligation: {}", obligation);
+ LOGGER.info("Obligation: {}", obligation);
for (AttributeAssignment assignment : obligation.getAttributeAssignments()) {
for (AttributeAssignment assignment : obligation.getAttributeAssignments()) {
- LOGGER.debug("Attribute Assignment: {}", assignment);
+ LOGGER.info("Attribute Assignment: {}", assignment);
//
// We care about the content attribute
//
//
// We care about the content attribute
//
// The contents are in Json form
//
Object stringContents = assignment.getAttributeValue().getValue();
// The contents are in Json form
//
Object stringContents = assignment.getAttributeValue().getValue();
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Policy contents: {}{}", System.lineSeparator(), stringContents);
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Policy contents: {}{}", System.lineSeparator(), stringContents);
}
//
// Let's parse it into a map using Gson
}
//
// Let's parse it into a map using Gson
// Find policyScope and policyType
//
if (entrySet.getKey().equals("policyScope")) {
// Find policyScope and policyType
//
if (entrySet.getKey().equals("policyScope")) {
- LOGGER.debug("Found policyScope: {}", entrySet.getValue());
+ LOGGER.info("Found policyScope: {}", entrySet.getValue());
if (entrySet.getValue() instanceof Collection) {
targetType.getAnyOf().add(generateMatches((Collection<Object>) entrySet.getValue(),
ToscaDictionary.ID_RESOURCE_POLICY_SCOPE_PROPERTY));
if (entrySet.getValue() instanceof Collection) {
targetType.getAnyOf().add(generateMatches((Collection<Object>) entrySet.getValue(),
ToscaDictionary.ID_RESOURCE_POLICY_SCOPE_PROPERTY));
}
}
if (entrySet.getKey().equals("policyType")) {
}
}
if (entrySet.getKey().equals("policyType")) {
- LOGGER.debug("Found policyType: {}", entrySet.getValue());
+ LOGGER.info("Found policyType: {}", entrySet.getValue());
if (entrySet.getValue() instanceof Collection) {
targetType.getAnyOf().add(generateMatches((Collection<Object>) entrySet.getValue(),
ToscaDictionary.ID_RESOURCE_POLICY_TYPE_PROPERTY));
if (entrySet.getValue() instanceof Collection) {
targetType.getAnyOf().add(generateMatches((Collection<Object>) entrySet.getValue(),
ToscaDictionary.ID_RESOURCE_POLICY_TYPE_PROPERTY));
//
// Convert the YAML Policy to JSON Object
//
//
// Convert the YAML Policy to JSON Object
//
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("JSON Optimization Policy {}{}", System.lineSeparator(), jsonPolicy);
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("JSON Optimization Policy {}{}", System.lineSeparator(), jsonPolicy);
}
//
// Create an AttributeValue for it
}
//
// Create an AttributeValue for it
@Override
public void configure(String id, Properties properties) throws PIPException {
super.configure(id, properties);
@Override
public void configure(String id, Properties properties) throws PIPException {
super.configure(id, properties);
- logger.debug("Configuring historyDb PIP {}", properties);
+ logger.info("Configuring historyDb PIP {}", properties);
this.properties = properties;
}
this.properties = properties;
}
//
try {
pdpProperties = XacmlPolicyUtils.loadXacmlProperties(XacmlPolicyUtils.getPropertiesPath(pathForData));
//
try {
pdpProperties = XacmlPolicyUtils.loadXacmlProperties(XacmlPolicyUtils.getPropertiesPath(pathForData));
- LOGGER.debug("{}", pdpProperties);
+ LOGGER.info("{}", pdpProperties);
} catch (IOException e) {
throw new XacmlApplicationException("Failed to load xacml.propertis", e);
}
} catch (IOException e) {
throw new XacmlApplicationException("Failed to load xacml.propertis", e);
}
// Maybe check for an error
//
XACMLPolicyWriter.writePolicyFile(refPath, xacmlPolicy);
// Maybe check for an error
//
XACMLPolicyWriter.writePolicyFile(refPath, xacmlPolicy);
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Xacml Policy is {}{}", System.lineSeparator(), new String(Files.readAllBytes(refPath)));
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Xacml Policy is {}{}", System.lineSeparator(), new String(Files.readAllBytes(refPath)));
}
//
// Add root policy to properties object
}
//
// Add root policy to properties object
* @throws IOException If unable to read file
*/
protected synchronized Properties loadXacmlProperties() throws IOException {
* @throws IOException If unable to read file
*/
protected synchronized Properties loadXacmlProperties() throws IOException {
- LOGGER.debug("Loading xacml properties {}", pathForData);
+ LOGGER.info("Loading xacml properties {}", pathForData);
try (InputStream is = Files.newInputStream(pathForData)) {
Properties properties = new Properties();
properties.load(is);
try (InputStream is = Files.newInputStream(pathForData)) {
Properties properties = new Properties();
properties.load(is);
// Check if we were able to create the rule
//
if (rule == null) {
// Check if we were able to create the rule
//
if (rule == null) {
- LOGGER.warn("Failed to create rule");
+ LOGGER.error("Failed to create rule");
@Override
public Request convertRequest(DecisionRequest request) {
@Override
public Request convertRequest(DecisionRequest request) {
- LOGGER.debug("Converting Request {}", request);
+ LOGGER.info("Converting Request {}", request);
try {
return RequestParser.parseRequest(LegacyGuardPolicyRequest.createInstance(request));
} catch (IllegalArgumentException | IllegalAccessException | DataTypeException e) {
try {
return RequestParser.parseRequest(LegacyGuardPolicyRequest.createInstance(request));
} catch (IllegalArgumentException | IllegalAccessException | DataTypeException e) {
@Override
public DecisionResponse convertResponse(Response xacmlResponse) {
@Override
public DecisionResponse convertResponse(Response xacmlResponse) {
- LOGGER.debug("Converting Response {}", xacmlResponse);
+ LOGGER.info("Converting Response {}", xacmlResponse);
DecisionResponse decisionResponse = new DecisionResponse();
//
// Iterate through all the results
DecisionResponse decisionResponse = new DecisionResponse();
//
// Iterate through all the results
//
Integer limit = parseInteger(properties.get("limit").toString());
if (limit == null) {
//
Integer limit = parseInteger(properties.get("limit").toString());
if (limit == null) {
- LOGGER.debug("Must have a limit value for frequency guard policy to be created");
+ LOGGER.error("Must have a limit value for frequency guard policy to be created");