diff options
Diffstat (limited to 'runtime/src/main')
8 files changed, 545 insertions, 630 deletions
diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java b/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java index 07c174293..bdab9c9a2 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java @@ -6,6 +6,7 @@ * reserved. * ================================================================================ * Modifications Copyright (c) 2019 Samsung + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +21,6 @@ * limitations under the License. * ============LICENSE_END============================================ * =================================================================== - * */ package org.onap.policy.clamp.clds; @@ -61,7 +61,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @ComponentScan(basePackages = {"org.onap.policy.clamp"}) @SpringBootApplication(exclude = {SecurityAutoConfiguration.class, UserDetailsServiceAutoConfiguration.class, - ServletMappingAutoConfiguration.class}) + ServletMappingAutoConfiguration.class}) @EnableJpaRepositories(basePackages = {"org.onap.policy.clamp"}) @EntityScan(basePackages = {"org.onap.policy.clamp"}) @EnableTransactionManagement diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java b/runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java index 6eb3c7195..52f1c5d23 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java +++ b/runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2018 AT&T Intellectual Property. All rights * reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -103,8 +104,8 @@ public class LoopElementModel extends AuditEntity implements Serializable { name = "loopelementmodels_to_policymodels", joinColumns = @JoinColumn(name = "loop_element_name", referencedColumnName = "name"), inverseJoinColumns = { - @JoinColumn(name = "policy_model_type", referencedColumnName = "policy_model_type"), - @JoinColumn(name = "policy_model_version", referencedColumnName = "version")}) + @JoinColumn(name = "policy_model_type", referencedColumnName = "policy_model_type"), + @JoinColumn(name = "policy_model_version", referencedColumnName = "version")}) @SortNatural private SortedSet<PolicyModel> policyModels = new TreeSet<>(); diff --git a/runtime/src/main/java/org/onap/policy/clamp/tosca/Dictionary.java b/runtime/src/main/java/org/onap/policy/clamp/tosca/Dictionary.java index 4f748d5dd..40ea25ff8 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/tosca/Dictionary.java +++ b/runtime/src/main/java/org/onap/policy/clamp/tosca/Dictionary.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2020 AT&T Intellectual Property. All rights * reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,8 +71,8 @@ public class Dictionary extends AuditEntity implements Serializable { name = "dictionary_to_dictionaryelements", joinColumns = @JoinColumn(name = "dictionary_name", referencedColumnName = "name"), inverseJoinColumns = {@JoinColumn( - name = "dictionary_element_short_name", - referencedColumnName = "short_name")}) + name = "dictionary_element_short_name", + referencedColumnName = "short_name")}) private Set<DictionaryElement> dictionaryElements = new HashSet<>(); /** diff --git a/runtime/src/main/resources/clds/camel/rest/clds-services.xml b/runtime/src/main/resources/clds/camel/rest/clds-services.xml index aa4c3cbee..e92b7b272 100644 --- a/runtime/src/main/resources/clds/camel/rest/clds-services.xml +++ b/runtime/src/main/resources/clds/camel/rest/clds-services.xml @@ -1,24 +1,24 @@ <rests xmlns="http://camel.apache.org/schema/spring"> - <rest> - <get uri="/v1/healthcheck" produces="application/json" - outType="org.onap.policy.clamp.clds.model.CldsHealthCheck"> - <route> - <setBody> - <method ref="org.onap.policy.clamp.clds.service.CldsHealthcheckService" - method="gethealthcheck()" /> - </setBody> - <when> - <simple> ${body} == 'NOT-OK'</simple> - <setHeader name="CamelHttpResponseCode"> - <constant>404</constant> - </setHeader> - <log loggingLevel="ERROR" message="HealthCheck failed" /> - </when> - </route> - </get> + <rest> + <get uri="/v1/healthcheck" produces="application/json" + outType="org.onap.policy.clamp.clds.model.CldsHealthCheck"> + <route> + <setBody> + <method ref="org.onap.policy.clamp.clds.service.CldsHealthcheckService" + method="gethealthcheck()" /> + </setBody> + <when> + <simple> ${body} == 'NOT-OK'</simple> + <setHeader name="CamelHttpResponseCode"> + <constant>404</constant> + </setHeader> + <log loggingLevel="ERROR" message="HealthCheck failed" /> + </when> + </route> + </get> - <get uri="/v1/user/getUser" produces="text/plain"> - <to uri="bean:org.onap.policy.clamp.authorization.UserService?method=getUser()" /> - </get> - </rest> + <get uri="/v1/user/getUser" produces="text/plain"> + <to uri="bean:org.onap.policy.clamp.authorization.UserService?method=getUser()" /> + </get> + </rest> </rests> diff --git a/runtime/src/main/resources/clds/camel/routes/loop-flows.xml b/runtime/src/main/resources/clds/camel/routes/loop-flows.xml index 4a3cc84b2..85e73ed2e 100644 --- a/runtime/src/main/resources/clds/camel/routes/loop-flows.xml +++ b/runtime/src/main/resources/clds/camel/routes/loop-flows.xml @@ -1,256 +1,256 @@ <routes xmlns="http://camel.apache.org/schema/spring"> - <route id="load-loop"> - <from uri="direct:load-loop" /> - <setBody> - <simple>${header.loopName}</simple> - </setBody> - <setProperty name="loopObject"> - <method ref="org.onap.policy.clamp.loop.LoopService" method="getLoop" /> - </setProperty> + <route id="load-loop"> + <from uri="direct:load-loop" /> + <setBody> + <simple>${header.loopName}</simple> + </setBody> + <setProperty name="loopObject"> + <method ref="org.onap.policy.clamp.loop.LoopService" method="getLoop" /> + </setProperty> - <when> - <simple>${exchangeProperty[loopObject]} == null</simple> - <setHeader name="CamelHttpResponseCode"> - <constant>404</constant> - </setHeader> - <log loggingLevel="WARN" message="Loop not found in database: ${body}" /> - <stop /> - </when> - </route> - <route id="update-policy-status-for-loop"> - <from uri="direct:update-policy-status-for-loop" /> - <setProperty name="policyComponent"> - <simple>${exchangeProperty[loopObject].getComponent('POLICY')} - </simple> - </setProperty> - <setProperty name="policyFound"> - <simple resultType="java.lang.Boolean">true</simple> - </setProperty> - <setProperty name="policyDeployed"> - <simple resultType="java.lang.Boolean">true</simple> - </setProperty> - <log loggingLevel="INFO" - message="Processing all MICRO-SERVICES policies defined in loop ${exchangeProperty[loopObject].getName()}" /> - <split> - <simple>${exchangeProperty[loopObject].getMicroServicePolicies()} - </simple> - <setProperty name="policyName"> - <simple>${body.getName()}</simple> - </setProperty> - <setProperty name="policyType"> - <simple>${body.getPolicyModel().getPolicyModelType()}</simple> - </setProperty> - <setProperty name="policyTypeVersion"> - <simple>${body.getPolicyModel().getVersion()}</simple> - </setProperty> - <setProperty name="policyPdpGroup"> - <simple>${body.getPdpGroup()}</simple> - </setProperty> - <setProperty name="policyVersion"> - <simple>1.0.0</simple> - </setProperty> - <setBody> - <constant>null</constant> - </setBody> - <log loggingLevel="INFO" - message="Processing Micro Service Policy: ${exchangeProperty[policyName]} of type ${exchangeProperty[policyType]}" /> - <to uri="direct:verify-one-policy" /> - </split> - <log loggingLevel="INFO" - message="Processing all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}" /> - <split> - <simple>${exchangeProperty[loopObject].getOperationalPolicies()} - </simple> - <setProperty name="policyName"> - <simple>${body.getName()}</simple> - </setProperty> - <setProperty name="policyType"> - <simple>${body.getPolicyModel().getPolicyModelType()}</simple> - </setProperty> - <setProperty name="policyTypeVersion"> - <simple>${body.getPolicyModel().getVersion()}</simple> - </setProperty> - <setProperty name="policyVersion"> - <simple>1.0.0</simple> - </setProperty> - <setProperty name="policyPdpGroup"> - <simple>${body.getPdpGroup()}</simple> - </setProperty> - <setBody> - <constant>null</constant> - </setBody> - <log loggingLevel="INFO" - message="Processing Operational Policy: ${exchangeProperty[policyName]} of type ${exchangeProperty[policyType]}" /> - <to uri="direct:verify-one-policy" /> - </split> - <setProperty name="policyState"> - <simple> ${exchangeProperty[policyComponent].getState()} - </simple> - </setProperty> - <log loggingLevel="INFO" - message="Policy state set to: ${exchangeProperty[policyState].getStateName()}" /> - <to - uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLogForComponent('Policy state set to: ${exchangeProperty[policyState].getStateName()}','INFO','POLICY',${exchangeProperty[loopObject]})" /> - </route> - <route id="update-dcae-status-for-loop"> - <from uri="direct:update-dcae-status-for-loop" /> - <log loggingLevel="INFO" - message="Updating DCAE status for loop: ${exchangeProperty[loopObject].getName()}" /> - <choice> - <when> - <simple>${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == true - </simple> - <setProperty name="dcaeComponent"> - <simple>${exchangeProperty[loopObject].getComponent('DCAE')}</simple> - </setProperty> - <when> - <simple>${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()} != null - </simple> - <setProperty name="getStatusUrl"> - <simple>${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}</simple> - </setProperty> - <setProperty name="raiseHttpExceptionFlag"> - <simple resultType="java.lang.Boolean">false</simple> - </setProperty> - <to uri="direct:get-dcae-deployment-status" /> - <when> - <simple> ${header.CamelHttpResponseCode} == 200 </simple> - <convertBodyTo type="java.lang.String" /> - <setProperty name="dcaeResponse"> - <method ref="org.onap.policy.clamp.loop.components.external.DcaeComponent" - method="convertDcaeResponse(${body})" /> - </setProperty> - </when> - </when> - <setProperty name="dcaeState"> - <simple> ${exchangeProperty[dcaeComponent].computeState(*)} - </simple> - </setProperty> - <log loggingLevel="INFO" - message="DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - DCAE message: ${exchangeProperty[dcaeResponse].getError()}" /> - <to - uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLogForComponent('DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - message: ${exchangeProperty[dcaeResponse].getError()}','INFO','DCAE',${exchangeProperty[loopObject]})" /> - </when> - <when> - <simple>${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == false - </simple> - <split> - <simple>${exchangeProperty[loopObject].getMicroServicePolicies()} - </simple> - <setProperty name="microServicePolicy"> - <simple>${body}</simple> - </setProperty> - <setProperty name="dcaeComponent"> - <simple>${exchangeProperty[loopObject].getComponent('DCAE_' + ${exchangeProperty[microServicePolicy].getName()})}</simple> - </setProperty> - <when> - <simple>${exchangeProperty[microServicePolicy].getDcaeDeploymentStatusUrl()} != null - </simple> - <setProperty name="getStatusUrl"> - <simple>${exchangeProperty[microServicePolicy].getDcaeDeploymentStatusUrl()}</simple> - </setProperty> - <setProperty name="raiseHttpExceptionFlag"> - <simple resultType="java.lang.Boolean">false</simple> - </setProperty> - <to uri="direct:get-dcae-deployment-status" /> - <when> - <simple> ${header.CamelHttpResponseCode} == 200 </simple> - <convertBodyTo type="java.lang.String" /> - <setProperty name="dcaeResponse"> - <method ref="org.onap.policy.clamp.loop.components.external.DcaeComponent" - method="convertDcaeResponse(${body})" /> - </setProperty> - </when> - </when> - <setProperty name="dcaeState"> - <simple> ${exchangeProperty[dcaeComponent].computeState(*)} - </simple> - </setProperty> - <log loggingLevel="INFO" - message="DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - DCAE message: ${exchangeProperty[dcaeResponse].getError()}" /> - <to - uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLogForComponent('DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - message: ${exchangeProperty[dcaeResponse].getError()}','INFO','DCAE',${exchangeProperty[microServicePolicy]})" /> - </split>> - </when> - </choice> - </route> - <route id="direct:update-loop-state"> - <from uri="direct:update-loop-state" /> - <log loggingLevel="INFO" - message="Updating status for loop: ${exchangeProperty[loopObject].getName()}" /> - <choice> - <when> - <simple>${exchangeProperty['dcaeState'].getStateName()} == - 'BLUEPRINT_DEPLOYED' && ${exchangeProperty['policyState'].getStateName()} - == 'NOT_SENT' - </simple> - <to - uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'DESIGN')" /> - </when> - <when> - <simple>${exchangeProperty['dcaeState'].getStateName()} == 'IN_ERROR' || - ${exchangeProperty['dcaeState'].getStateName()} == - 'MICROSERVICE_INSTALLATION_FAILED' - </simple> - <to - uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'IN_ERROR')" /> - </when> - <when> - <simple>${exchangeProperty['dcaeState'].getStateName()} == - 'MICROSERVICE_UNINSTALLATION_FAILED' || - ${exchangeProperty['policyState'].getStateName()} == 'IN_ERROR' - </simple> - <to - uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'IN_ERROR')" /> - </when> - <when> - <simple>${exchangeProperty['dcaeState'].getStateName()} == - 'MICROSERVICE_INSTALLED_SUCCESSFULLY' && - ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED' - </simple> - <to - uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'RUNNING')" /> - </when> - <when> - <simple>${exchangeProperty['dcaeState'].getStateName()} == - 'MICROSERVICE_INSTALLED_SUCCESSFULLY' && - ${exchangeProperty['policyState'].getStateName()} == 'SENT' - </simple> - <to - uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'STOPPED')" /> - </when> - <when> - <simple>${exchangeProperty['dcaeState'].getStateName()} == - 'BLUEPRINT_DEPLOYED' || ${exchangeProperty['dcaeState'].getStateName()} == - 'MICROSERVICE_UNINSTALLED_SUCCESSFULLY' && - ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED' - </simple> - <to - uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'SUBMITTED')" /> - </when> - <when> - <simple>${exchangeProperty['dcaeState'].getStateName()} == - 'PROCESSING_MICROSERVICE_INSTALLATION' || - ${exchangeProperty['dcaeState'].getStateName()} == - 'PROCESSING_MICROSERVICE_UNINSTALLATION' && - ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED' - </simple> - <to - uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'WAITING')" /> - </when> - <when> - <simple>${exchangeProperty['dcaeState'].getStateName()} == - 'MICROSERVICE_INSTALLED_SUCCESSFULLY' && - ${exchangeProperty['policyState'].getStateName()} != 'NOT_SENT' - </simple> - <to - uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'DEPLOYED')" /> - </when> - </choice> - <log loggingLevel="INFO" - message="New loop state is: ${exchangeProperty[loopObject].getLastComputedState().toString()}" /> - <to - uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLog('New loop state is: ${exchangeProperty[loopObject].getLastComputedState().toString()}','INFO',${exchangeProperty[loopObject]})" /> + <when> + <simple>${exchangeProperty[loopObject]} == null</simple> + <setHeader name="CamelHttpResponseCode"> + <constant>404</constant> + </setHeader> + <log loggingLevel="WARN" message="Loop not found in database: ${body}" /> + <stop /> + </when> + </route> + <route id="update-policy-status-for-loop"> + <from uri="direct:update-policy-status-for-loop" /> + <setProperty name="policyComponent"> + <simple>${exchangeProperty[loopObject].getComponent('POLICY')} + </simple> + </setProperty> + <setProperty name="policyFound"> + <simple resultType="java.lang.Boolean">true</simple> + </setProperty> + <setProperty name="policyDeployed"> + <simple resultType="java.lang.Boolean">true</simple> + </setProperty> + <log loggingLevel="INFO" + message="Processing all MICRO-SERVICES policies defined in loop ${exchangeProperty[loopObject].getName()}" /> + <split> + <simple>${exchangeProperty[loopObject].getMicroServicePolicies()} + </simple> + <setProperty name="policyName"> + <simple>${body.getName()}</simple> + </setProperty> + <setProperty name="policyType"> + <simple>${body.getPolicyModel().getPolicyModelType()}</simple> + </setProperty> + <setProperty name="policyTypeVersion"> + <simple>${body.getPolicyModel().getVersion()}</simple> + </setProperty> + <setProperty name="policyPdpGroup"> + <simple>${body.getPdpGroup()}</simple> + </setProperty> + <setProperty name="policyVersion"> + <simple>1.0.0</simple> + </setProperty> + <setBody> + <constant>null</constant> + </setBody> + <log loggingLevel="INFO" + message="Processing Micro Service Policy: ${exchangeProperty[policyName]} of type ${exchangeProperty[policyType]}" /> + <to uri="direct:verify-one-policy" /> + </split> + <log loggingLevel="INFO" + message="Processing all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}" /> + <split> + <simple>${exchangeProperty[loopObject].getOperationalPolicies()} + </simple> + <setProperty name="policyName"> + <simple>${body.getName()}</simple> + </setProperty> + <setProperty name="policyType"> + <simple>${body.getPolicyModel().getPolicyModelType()}</simple> + </setProperty> + <setProperty name="policyTypeVersion"> + <simple>${body.getPolicyModel().getVersion()}</simple> + </setProperty> + <setProperty name="policyVersion"> + <simple>1.0.0</simple> + </setProperty> + <setProperty name="policyPdpGroup"> + <simple>${body.getPdpGroup()}</simple> + </setProperty> + <setBody> + <constant>null</constant> + </setBody> + <log loggingLevel="INFO" + message="Processing Operational Policy: ${exchangeProperty[policyName]} of type ${exchangeProperty[policyType]}" /> + <to uri="direct:verify-one-policy" /> + </split> + <setProperty name="policyState"> + <simple> ${exchangeProperty[policyComponent].getState()} + </simple> + </setProperty> + <log loggingLevel="INFO" + message="Policy state set to: ${exchangeProperty[policyState].getStateName()}" /> + <to + uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLogForComponent('Policy state set to: ${exchangeProperty[policyState].getStateName()}','INFO','POLICY',${exchangeProperty[loopObject]})" /> + </route> + <route id="update-dcae-status-for-loop"> + <from uri="direct:update-dcae-status-for-loop" /> + <log loggingLevel="INFO" + message="Updating DCAE status for loop: ${exchangeProperty[loopObject].getName()}" /> + <choice> + <when> + <simple>${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == true + </simple> + <setProperty name="dcaeComponent"> + <simple>${exchangeProperty[loopObject].getComponent('DCAE')}</simple> + </setProperty> + <when> + <simple>${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()} != null + </simple> + <setProperty name="getStatusUrl"> + <simple>${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}</simple> + </setProperty> + <setProperty name="raiseHttpExceptionFlag"> + <simple resultType="java.lang.Boolean">false</simple> + </setProperty> + <to uri="direct:get-dcae-deployment-status" /> + <when> + <simple> ${header.CamelHttpResponseCode} == 200 </simple> + <convertBodyTo type="java.lang.String" /> + <setProperty name="dcaeResponse"> + <method ref="org.onap.policy.clamp.loop.components.external.DcaeComponent" + method="convertDcaeResponse(${body})" /> + </setProperty> + </when> + </when> + <setProperty name="dcaeState"> + <simple> ${exchangeProperty[dcaeComponent].computeState(*)} + </simple> + </setProperty> + <log loggingLevel="INFO" + message="DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - DCAE message: ${exchangeProperty[dcaeResponse].getError()}" /> + <to + uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLogForComponent('DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - message: ${exchangeProperty[dcaeResponse].getError()}','INFO','DCAE',${exchangeProperty[loopObject]})" /> + </when> + <when> + <simple>${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == false + </simple> + <split> + <simple>${exchangeProperty[loopObject].getMicroServicePolicies()} + </simple> + <setProperty name="microServicePolicy"> + <simple>${body}</simple> + </setProperty> + <setProperty name="dcaeComponent"> + <simple>${exchangeProperty[loopObject].getComponent('DCAE_' + ${exchangeProperty[microServicePolicy].getName()})}</simple> + </setProperty> + <when> + <simple>${exchangeProperty[microServicePolicy].getDcaeDeploymentStatusUrl()} != null + </simple> + <setProperty name="getStatusUrl"> + <simple>${exchangeProperty[microServicePolicy].getDcaeDeploymentStatusUrl()}</simple> + </setProperty> + <setProperty name="raiseHttpExceptionFlag"> + <simple resultType="java.lang.Boolean">false</simple> + </setProperty> + <to uri="direct:get-dcae-deployment-status" /> + <when> + <simple> ${header.CamelHttpResponseCode} == 200 </simple> + <convertBodyTo type="java.lang.String" /> + <setProperty name="dcaeResponse"> + <method ref="org.onap.policy.clamp.loop.components.external.DcaeComponent" + method="convertDcaeResponse(${body})" /> + </setProperty> + </when> + </when> + <setProperty name="dcaeState"> + <simple> ${exchangeProperty[dcaeComponent].computeState(*)} + </simple> + </setProperty> + <log loggingLevel="INFO" + message="DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - DCAE message: ${exchangeProperty[dcaeResponse].getError()}" /> + <to + uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLogForComponent('DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - message: ${exchangeProperty[dcaeResponse].getError()}','INFO','DCAE',${exchangeProperty[microServicePolicy]})" /> + </split>> + </when> + </choice> + </route> + <route id="direct:update-loop-state"> + <from uri="direct:update-loop-state" /> + <log loggingLevel="INFO" + message="Updating status for loop: ${exchangeProperty[loopObject].getName()}" /> + <choice> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == + 'BLUEPRINT_DEPLOYED' && ${exchangeProperty['policyState'].getStateName()} + == 'NOT_SENT' + </simple> + <to + uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'DESIGN')" /> + </when> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == 'IN_ERROR' || + ${exchangeProperty['dcaeState'].getStateName()} == + 'MICROSERVICE_INSTALLATION_FAILED' + </simple> + <to + uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'IN_ERROR')" /> + </when> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == + 'MICROSERVICE_UNINSTALLATION_FAILED' || + ${exchangeProperty['policyState'].getStateName()} == 'IN_ERROR' + </simple> + <to + uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'IN_ERROR')" /> + </when> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == + 'MICROSERVICE_INSTALLED_SUCCESSFULLY' && + ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED' + </simple> + <to + uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'RUNNING')" /> + </when> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == + 'MICROSERVICE_INSTALLED_SUCCESSFULLY' && + ${exchangeProperty['policyState'].getStateName()} == 'SENT' + </simple> + <to + uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'STOPPED')" /> + </when> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == + 'BLUEPRINT_DEPLOYED' || ${exchangeProperty['dcaeState'].getStateName()} == + 'MICROSERVICE_UNINSTALLED_SUCCESSFULLY' && + ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED' + </simple> + <to + uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'SUBMITTED')" /> + </when> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == + 'PROCESSING_MICROSERVICE_INSTALLATION' || + ${exchangeProperty['dcaeState'].getStateName()} == + 'PROCESSING_MICROSERVICE_UNINSTALLATION' && + ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED' + </simple> + <to + uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'WAITING')" /> + </when> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == + 'MICROSERVICE_INSTALLED_SUCCESSFULLY' && + ${exchangeProperty['policyState'].getStateName()} != 'NOT_SENT' + </simple> + <to + uri="bean:org.onap.policy.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'DEPLOYED')" /> + </when> + </choice> + <log loggingLevel="INFO" + message="New loop state is: ${exchangeProperty[loopObject].getLastComputedState().toString()}" /> + <to + uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLog('New loop state is: ${exchangeProperty[loopObject].getLastComputedState().toString()}','INFO',${exchangeProperty[loopObject]})" /> - </route> -</routes>
\ No newline at end of file + </route> +</routes> diff --git a/runtime/src/main/resources/clds/camel/routes/utils-flows.xml b/runtime/src/main/resources/clds/camel/routes/utils-flows.xml index 90900f842..da91335c8 100644 --- a/runtime/src/main/resources/clds/camel/routes/utils-flows.xml +++ b/runtime/src/main/resources/clds/camel/routes/utils-flows.xml @@ -1,28 +1,28 @@ <routes xmlns="http://camel.apache.org/schema/spring"> - <route id="reset-raise-http-exception-flag"> - <from uri="direct:reset-raise-http-exception-flag" /> - <setProperty name="raiseHttpExceptionFlag"> - <simple resultType="java.lang.Boolean">true</simple> - </setProperty> - </route> + <route id="reset-raise-http-exception-flag"> + <from uri="direct:reset-raise-http-exception-flag" /> + <setProperty name="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}" /> - <choice> - <when> - <simple>${exchangeProperty[logComponent]} == null</simple> - <to - uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLog('${exchangeProperty[logMessage]} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}','INFO',${exchangeProperty[loopObject]})" /> - </when> - <otherwise> - <to - uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLogForComponent('${exchangeProperty[logMessage]} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}','INFO','${exchangeProperty[logComponent]}',${exchangeProperty[loopObject]})" /> - <setProperty name="logComponent"> - <constant>null</constant> - </setProperty> - </otherwise> - </choice> - </route> -</routes>
\ No newline at end of file + <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}" /> + <choice> + <when> + <simple>${exchangeProperty[logComponent]} == null</simple> + <to + uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLog('${exchangeProperty[logMessage]} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}','INFO',${exchangeProperty[loopObject]})" /> + </when> + <otherwise> + <to + uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLogForComponent('${exchangeProperty[logMessage]} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}','INFO','${exchangeProperty[logComponent]}',${exchangeProperty[loopObject]})" /> + <setProperty name="logComponent"> + <constant>null</constant> + </setProperty> + </otherwise> + </choice> + </route> +</routes> diff --git a/runtime/src/main/resources/logback-default.xml b/runtime/src/main/resources/logback-default.xml index 5397eab04..1d7b2a14f 100644 --- a/runtime/src/main/resources/logback-default.xml +++ b/runtime/src/main/resources/logback-default.xml @@ -1,110 +1,78 @@ <included> - <jmxConfigurator /> - <!-- Example evaluator filter applied against console appender --> - <property - name="p_tim" - value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC}" /> - <property - name="p_lvl" - value="%level" /> - <property - name="p_log" - value="%logger" /> - <property - name="p_mdc" - value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}" /> - <property - name="p_msg" - value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}" /> - <property - name="p_exc" - value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}" /> - <property - name="p_mak" - value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}" /> - <property - name="p_thr" - value="%thread" /> - <property - name="defaultPattern" - value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n" /> - <property - name="debugPattern" - value="%nopexception${p_tim}|${p_lvl}|${p_mdc}|${p_exc}|%msg%n" /> - - <property - name="errorPattern" - value="%X{EntryTimestamp}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}||||%msg%n" /> - - <property - name="auditPattern" - value="%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%marker|%mdc|||%msg%n" /> - - <property - name="metricPattern" - value="%X{InvokeTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|%marker|%mdc|||%msg%n" /> - - - <!-- Example evaluator filter applied against console appender --> - <appender - name="STDOUT" - class="ch.qos.logback.core.ConsoleAppender"> - <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> - <level>INFO</level> - </filter> - <encoder> - <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n - </pattern> - </encoder> - </appender> - - <appender - name="ERROR" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <jmxConfigurator /> + <!-- Example evaluator filter applied against console appender --> + <property name="p_tim" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC}" /> + <property name="p_lvl" value="%level" /> + <property name="p_log" value="%logger" /> + <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}" /> + <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}" /> + <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}" /> + <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}" /> + <property name="p_thr" value="%thread" /> + <property name="defaultPattern" + value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n" /> + <property name="debugPattern" value="%nopexception${p_tim}|${p_lvl}|${p_mdc}|${p_exc}|%msg%n" /> + + <property name="errorPattern" + value="%X{EntryTimestamp}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}||||%msg%n" /> + + <property name="auditPattern" + value="%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%marker|%mdc|||%msg%n" /> + + <property name="metricPattern" + value="%X{InvokeTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|%marker|%mdc|||%msg%n" /> + + + <!-- Example evaluator filter applied against console appender --> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + <encoder> + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n + </pattern> + </encoder> + </appender> + + <appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>ERROR</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> - <file>${logDirectory}/error.log</file> - <append>true</append> - <encoder> - <pattern>${errorPattern}</pattern> - </encoder> - <rollingPolicy - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/error.%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - <maxFileSize>50MB</maxFileSize> - <maxHistory>20</maxHistory> - <totalSizeCap>1GB</totalSizeCap> - </rollingPolicy> - </appender> - - <appender - name="DEBUG" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDirectory}/debug.log</file> - <append>true</append> - <encoder> - <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n - </pattern> - </encoder> - <rollingPolicy - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/debug.%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - <maxFileSize>50MB</maxFileSize> - <maxHistory>20</maxHistory> - <totalSizeCap>1GB</totalSizeCap> - </rollingPolicy> - </appender> - - - <appender - name="AUDIT" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <file>${logDirectory}/error.log</file> + <append>true</append> + <encoder> + <pattern>${errorPattern}</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/error.%d{yyyy-MM-dd}.%i.log.zip + </fileNamePattern> + <maxFileSize>50MB</maxFileSize> + <maxHistory>20</maxHistory> + <totalSizeCap>1GB</totalSizeCap> + </rollingPolicy> + </appender> + + <appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/debug.log</file> + <append>true</append> + <encoder> + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n + </pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/debug.%d{yyyy-MM-dd}.%i.log.zip + </fileNamePattern> + <maxFileSize>50MB</maxFileSize> + <maxHistory>20</maxHistory> + <totalSizeCap>1GB</totalSizeCap> + </rollingPolicy> + </appender> + + + <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> <marker>ENTRY</marker> <marker>EXIT</marker> @@ -112,31 +80,26 @@ <onMismatch>DENY</onMismatch> <onMatch>ACCEPT</onMatch> </filter> - <file>${logDirectory}/audit.log</file> - <append>true</append> - <encoder> - <pattern>${auditPattern}</pattern> - </encoder> - <rollingPolicy - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <FileNamePattern>${logDirectory}/audit.%d{yyyy-MM-dd}.%i.log.zip - </FileNamePattern> - <maxFileSize>50MB</maxFileSize> - <maxHistory>20</maxHistory> - <totalSizeCap>1GB</totalSizeCap> - </rollingPolicy> - </appender> - <appender - name="asyncEELFAudit" - class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>256</queueSize> - <appender-ref ref="AUDIT" /> - </appender> - - <appender - name="METRIC" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <file>${logDirectory}/audit.log</file> + <append>true</append> + <encoder> + <pattern>${auditPattern}</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <FileNamePattern>${logDirectory}/audit.%d{yyyy-MM-dd}.%i.log.zip + </FileNamePattern> + <maxFileSize>50MB</maxFileSize> + <maxHistory>20</maxHistory> + <totalSizeCap>1GB</totalSizeCap> + </rollingPolicy> + </appender> + <appender name="asyncEELFAudit" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="AUDIT" /> + </appender> + + <appender name="METRIC" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> <marker>INVOKE</marker> <marker>INVOKE-RETURN</marker> @@ -144,186 +107,136 @@ <onMismatch>DENY</onMismatch> <onMatch>ACCEPT</onMatch> </filter> - <file>${logDirectory}/metric.log</file> - <append>true</append> - <encoder> - <pattern>${metricPattern}</pattern> - </encoder> - <rollingPolicy - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <FileNamePattern>${logDirectory}/metric.%d{yyyy-MM-dd}.%i.log.zip - </FileNamePattern> - <maxFileSize>50MB</maxFileSize> - <maxHistory>20</maxHistory> - <totalSizeCap>1GB</totalSizeCap> - </rollingPolicy> - </appender> - - <appender - name="asyncEELFMetrics" - class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>256</queueSize> - <appender-ref ref="METRIC" /> - </appender> - - <!-- SECURITY related loggers --> - <appender - name="SECURITY" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDirectory}/security.log</file> - <append>true</append> - <encoder> - <pattern>%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%.20thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n - </pattern> - </encoder> - <rollingPolicy - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <FileNamePattern>${logDirectory}/security.%d{yyyy-MM-dd}.%i.log.zip - </FileNamePattern> - <maxFileSize>50MB</maxFileSize> - <maxHistory>20</maxHistory> - <totalSizeCap>1GB</totalSizeCap> - </rollingPolicy> - </appender> - - <appender - name="asyncEELFSecurity" - class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>256</queueSize> - <appender-ref ref="SECURITY" /> - </appender> - <!-- logback jms appenders & loggers definition starts here --> - <appender - name="auditLogs" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> - </filter> - <file>${logDirectory}/Audits.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/Audits-%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - <maxFileSize>50MB</maxFileSize> - <maxHistory>20</maxHistory> - <totalSizeCap>1GB</totalSizeCap> - </rollingPolicy> - <encoder> - <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern> - </encoder> - </appender> - - <appender - name="perfLogs" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> - </filter> - <file>${logDirectory}/Perform.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/Perform--%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - <maxFileSize>50MB</maxFileSize> - <maxHistory>20</maxHistory> - <totalSizeCap>1GB</totalSizeCap> - </rollingPolicy> - <encoder> - <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern> - </encoder> - </appender> - - <logger - name="org.onap.aaf" - level="DEBUG"> - <appender-ref ref="DEBUG" /> - </logger> - <logger - name="org.hibernate" - level="INFO"> - <appender-ref ref="DEBUG" /> - </logger> - <logger - name="org.apache.camel.Tracing" - level="INFO"> - <appender-ref ref="DEBUG" /> - </logger> - - <logger - name="org.apache" - level="INFO"> - <appender-ref ref="DEBUG" /> - </logger> - <!-- Spring related loggers --> - <logger - name="org.springframework" - level="INFO"> - <appender-ref ref="DEBUG" /> - </logger> - - <!-- CLAMP related loggers --> - <logger - name="org.onap.policy.clamp" - level="DEBUG"> - <appender-ref ref="ERROR" /> - <appender-ref ref="DEBUG" /> - </logger> - - <logger - name="com.att.eelf.error" - level="OFF"> - <appender-ref ref="ERROR" /> - </logger> - <!-- EELF related loggers --> - <logger - name="com.att.eelf.audit" - level="INFO" - additivity="false"> - <appender-ref ref="asyncEELFAudit" /> - </logger> - <logger - name="com.att.eelf.metrics" - level="DEBUG" - additivity="false"> - <appender-ref ref="asyncEELFMetrics" /> - </logger> - <logger - name="com.att.eelf.security" - level="DEBUG" - additivity="false"> - <appender-ref ref="asyncEELFSecurity" /> - </logger> - - <!-- logback internals logging --> - <logger - name="ch.qos.logback.classic" - level="INFO" /> - <logger - name="ch.qos.logback.core" - level="INFO" /> - <logger - name="AuditRecord" - level="INFO" - additivity="false"> - <appender-ref ref="auditLogs" /> - </logger> - <logger - name="AuditRecord_DirectCall" - level="INFO" - additivity="false"> - <appender-ref ref="auditLogs" /> - </logger> - <logger - name="PerfTrackerRecord" - level="INFO" - additivity="false"> - <appender-ref ref="perfLogs" /> - </logger> - <!-- logback jms appenders & loggers definition ends here --> + <file>${logDirectory}/metric.log</file> + <append>true</append> + <encoder> + <pattern>${metricPattern}</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <FileNamePattern>${logDirectory}/metric.%d{yyyy-MM-dd}.%i.log.zip + </FileNamePattern> + <maxFileSize>50MB</maxFileSize> + <maxHistory>20</maxHistory> + <totalSizeCap>1GB</totalSizeCap> + </rollingPolicy> + </appender> + + <appender name="asyncEELFMetrics" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="METRIC" /> + </appender> + + <!-- SECURITY related loggers --> + <appender name="SECURITY" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/security.log</file> + <append>true</append> + <encoder> + <pattern>%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%.20thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n + </pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <FileNamePattern>${logDirectory}/security.%d{yyyy-MM-dd}.%i.log.zip + </FileNamePattern> + <maxFileSize>50MB</maxFileSize> + <maxHistory>20</maxHistory> + <totalSizeCap>1GB</totalSizeCap> + </rollingPolicy> + </appender> + + <appender name="asyncEELFSecurity" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="SECURITY" /> + </appender> + <!-- logback jms appenders & loggers definition starts here --> + <appender name="auditLogs" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + </filter> + <file>${logDirectory}/Audits.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/Audits-%d{yyyy-MM-dd}.%i.log.zip + </fileNamePattern> + <maxFileSize>50MB</maxFileSize> + <maxHistory>20</maxHistory> + <totalSizeCap>1GB</totalSizeCap> + </rollingPolicy> + <encoder> + <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern> + </encoder> + </appender> + + <appender name="perfLogs" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + </filter> + <file>${logDirectory}/Perform.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/Perform--%d{yyyy-MM-dd}.%i.log.zip + </fileNamePattern> + <maxFileSize>50MB</maxFileSize> + <maxHistory>20</maxHistory> + <totalSizeCap>1GB</totalSizeCap> + </rollingPolicy> + <encoder> + <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern> + </encoder> + </appender> + + <logger name="org.onap.aaf" level="DEBUG"> + <appender-ref ref="DEBUG" /> + </logger> + <logger name="org.hibernate" level="INFO"> + <appender-ref ref="DEBUG" /> + </logger> + <logger name="org.apache.camel.Tracing" level="INFO"> + <appender-ref ref="DEBUG" /> + </logger> + + <logger name="org.apache" level="INFO"> + <appender-ref ref="DEBUG" /> + </logger> + <!-- Spring related loggers --> + <logger name="org.springframework" level="INFO"> + <appender-ref ref="DEBUG" /> + </logger> + + <!-- CLAMP related loggers --> + <logger name="org.onap.policy.clamp" level="DEBUG"> + <appender-ref ref="ERROR" /> + <appender-ref ref="DEBUG" /> + </logger> - <root level="DEBUG"> - <appender-ref ref="DEBUG" /> - <appender-ref ref="STDOUT" /> - <appender-ref ref="AUDIT" /> + <logger name="com.att.eelf.error" level="OFF"> + <appender-ref ref="ERROR" /> + </logger> + <!-- EELF related loggers --> + <logger name="com.att.eelf.audit" level="INFO" additivity="false"> + <appender-ref ref="asyncEELFAudit" /> + </logger> + <logger name="com.att.eelf.metrics" level="DEBUG" additivity="false"> + <appender-ref ref="asyncEELFMetrics" /> + </logger> + <logger name="com.att.eelf.security" level="DEBUG" additivity="false"> + <appender-ref ref="asyncEELFSecurity" /> + </logger> + + <!-- logback internals logging --> + <logger name="ch.qos.logback.classic" level="INFO" /> + <logger name="ch.qos.logback.core" level="INFO" /> + <logger name="AuditRecord" level="INFO" additivity="false"> + <appender-ref ref="auditLogs" /> + </logger> + <logger name="AuditRecord_DirectCall" level="INFO" additivity="false"> + <appender-ref ref="auditLogs" /> + </logger> + <logger name="PerfTrackerRecord" level="INFO" additivity="false"> + <appender-ref ref="perfLogs" /> + </logger> + <!-- logback jms appenders & loggers definition ends here --> + + <root level="DEBUG"> + <appender-ref ref="DEBUG" /> + <appender-ref ref="STDOUT" /> + <appender-ref ref="AUDIT" /> <appender-ref ref="METRIC" /> <appender-ref ref="ERROR" /> - </root> + </root> </included> diff --git a/runtime/src/main/resources/logback-spring.xml b/runtime/src/main/resources/logback-spring.xml index ffa497f1d..e7b67473c 100644 --- a/runtime/src/main/resources/logback-spring.xml +++ b/runtime/src/main/resources/logback-spring.xml @@ -1,19 +1,19 @@ <configuration debug="true"> - <springProperty name="logbackFilePath" - source="clamp.config.logback.path" /> - <springProperty name="logbackFileName" - source="clamp.config.logback.filename" /> - <springProperty name="logDirectory" - source="clamp.config.log.path" /> - - <if condition='isNull("logbackFilePath")'> - <then> - <!-- Classpath case --> - <include resource="${logbackFileName}" /> - </then> - <else> - <!-- File system case --> - <include file="${logbackFilePath}/${logbackFileName}" /> - </else> - </if> -</configuration>
\ No newline at end of file + <springProperty name="logbackFilePath" + source="clamp.config.logback.path" /> + <springProperty name="logbackFileName" + source="clamp.config.logback.filename" /> + <springProperty name="logDirectory" + source="clamp.config.log.path" /> + + <if condition='isNull("logbackFilePath")'> + <then> + <!-- Classpath case --> + <include resource="${logbackFileName}" /> + </then> + <else> + <!-- File system case --> + <include file="${logbackFilePath}/${logbackFileName}" /> + </else> + </if> +</configuration> |