diff options
author | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
---|---|---|
committer | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
commit | 280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch) | |
tree | 9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main | |
parent | fd3821dad11780d33c5373d74c957c442489945e (diff) |
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370
Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main')
20 files changed, 1587 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/BaseFactory.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/BaseFactory.java new file mode 100644 index 0000000000..3be67dfde2 --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/BaseFactory.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.api; + +import java.util.Iterator; +import java.util.ServiceLoader; + +/** + * Contains common functionality for factories used in the logging framework. + * + * <p>In order to use the factory, a particular (e.g. framework-specific) implementation of a service must be + * configured as described in + * <a href="http://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html">java.util.ServiceLoader</a>).</p> + * + * @author evitaliy + * @since 13/09/2016. + * + * @see ServiceLoader + */ +public class BaseFactory { + + protected static <T> T locateService(Class<T> clazz) throws Exception { + + T service; + ServiceLoader<T> loader = ServiceLoader.load(clazz); + Iterator<T> iterator = loader.iterator(); + if (iterator.hasNext()) { + + service = iterator.next(); + if (iterator.hasNext()) { + System.err.println(String.format("Warning! Configured more than one implementation of %s", + clazz.getName())); + } + + return service; + } + + throw new IllegalArgumentException((String.format("No implementations configured for %s", clazz.getName()))); + } +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/Logger.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/Logger.java new file mode 100644 index 0000000000..9055e64f8b --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/Logger.java @@ -0,0 +1,107 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.api; + +/** + * <p>This interface defines logging as specified by Open OPENECOMP logging requirements.</p> + * + * <p>Formatted messages must follow the <a href="http://www.slf4j.org/api/org/slf4j/helpers/MessageFormatter.html>SLF4J + * format</a>.</p> + * + * @author evitaliy + * @since 13/09/2016. + */ +public interface Logger { + + String getName(); + + boolean isMetricsEnabled(); + + void metrics(String msg); + + void metrics(String msg, Object arg); + + void metrics(String msg, Object arg1, Object arg2); + + void metrics(String msg, Object... arguments); + + void metrics(String msg, Throwable t); + + boolean isAuditEnabled(); + + void audit(String msg); + + void audit(String msg, Object arg); + + void audit(String msg, Object arg1, Object arg2); + + void audit(String msg, Object... arguments); + + void audit(String msg, Throwable t); + + boolean isDebugEnabled(); + + void debug(String msg); + + void debug(String msg, Object arg); + + void debug(String msg, Object arg1, Object arg2); + + void debug(String msg, Object... arguments); + + void debug(String msg, Throwable t); + + boolean isInfoEnabled(); + + void info(String msg); + + void info(String msg, Object arg); + + void info(String msg, Object arg1, Object arg2); + + void info(String msg, Object... arguments); + + void info(String msg, Throwable t); + + boolean isWarnEnabled(); + + void warn(String msg); + + void warn(String msg, Object arg); + + void warn(String msg, Object... arguments); + + void warn(String msg, Object arg1, Object arg2); + + void warn(String msg, Throwable t); + + boolean isErrorEnabled(); + + void error(String msg); + + void error(String msg, Object arg); + + void error(String msg, Object arg1, Object arg2); + + void error(String msg, Object... arguments); + + void error(String msg, Throwable t); +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggerCreationService.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggerCreationService.java new file mode 100644 index 0000000000..fbad636412 --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggerCreationService.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.api; + +/** + * + * Implements a framework-specific logging, to be used by {@link LoggerFactory}. + * + * @author evitaliy + * @since 13/09/2016. + */ +public interface LoggerCreationService { + + Logger getLogger(String className); + + Logger getLogger(Class<?> clazz); +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggerFactory.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggerFactory.java new file mode 100644 index 0000000000..7029ded38d --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggerFactory.java @@ -0,0 +1,207 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.api; + + +/** + * <a>Factory to hide a concrete, framework-specific implementation of logger creation.</a> + * + * <p>The service used by this factory must implement {@link LoggerCreationService}. If no implementation has been + * configured or could not be instantiated, a <b>no-op logger</b> will be used, and <b>no events</b> will be logged. + * This is done to prevent recursion if attempts are being made to log exceptions that resulted from logger + * initialization. + * </p> + * + * @author evitaliy + * @since 13/09/2016. + * + * @see BaseFactory + * @see LoggerCreationService + */ +@SuppressWarnings("ThrowableInstanceNeverThrown") +public class LoggerFactory extends BaseFactory { + + private static final LoggerCreationService SERVICE; + + static { + LoggerCreationService service; + + try { + service = locateService(LoggerCreationService.class); + } catch (Throwable e) { + new RuntimeException("Failed to instantiate logger factory", e).printStackTrace(); + // use the no-op service to prevent recursion in case of an attempt to log an exception as a + // result of a logger initialization error + service = new NoOpLoggerCreationService(); + } + + SERVICE = service; + } + + public static Logger getLogger(String clazzName) { + return SERVICE.getLogger(clazzName); + } + + public static Logger getLogger(Class<?> clazz) { + return SERVICE.getLogger(clazz); + } + + private static class NoOpLoggerCreationService implements LoggerCreationService { + + private static final Logger NO_OP_LOGGER = new Logger() { + + @Override + public String getName() { + return "No-Op Logger"; + } + + @Override + public boolean isMetricsEnabled() { + return false; + } + + @Override + public void metrics(String msg) { } + + @Override + public void metrics(String msg, Object arg) { } + + @Override + public void metrics(String msg, Object arg1, Object arg2) { } + + @Override + public void metrics(String msg, Object... arguments) { } + + @Override + public void metrics(String msg, Throwable t) { } + + @Override + public boolean isAuditEnabled() { + return false; + } + + @Override + public void audit(String msg) { } + + @Override + public void audit(String msg, Object arg) { } + + @Override + public void audit(String msg, Object arg1, Object arg2) { } + + @Override + public void audit(String msg, Object... arguments) { } + + @Override + public void audit(String msg, Throwable t) { } + + @Override + public boolean isDebugEnabled() { + return false; + } + + @Override + public void debug(String msg) { } + + @Override + public void debug(String msg, Object arg) { } + + @Override + public void debug(String msg, Object arg1, Object arg2) { } + + @Override + public void debug(String msg, Object... arguments) { } + + @Override + public void debug(String msg, Throwable t) { } + + @Override + public boolean isInfoEnabled() { + return false; + } + + @Override + public void info(String msg) { } + + @Override + public void info(String msg, Object arg) { } + + @Override + public void info(String msg, Object arg1, Object arg2) { } + + @Override + public void info(String msg, Object... arguments) { } + + @Override + public void info(String msg, Throwable t) { } + + @Override + public boolean isWarnEnabled() { + return false; + } + + @Override + public void warn(String msg) { } + + @Override + public void warn(String msg, Object arg) { } + + @Override + public void warn(String msg, Object... arguments) { } + + @Override + public void warn(String msg, Object arg1, Object arg2) { } + + @Override + public void warn(String msg, Throwable t) { } + + @Override + public boolean isErrorEnabled() { + return false; + } + + @Override + public void error(String msg) { } + + @Override + public void error(String msg, Object arg) { } + + @Override + public void error(String msg, Object arg1, Object arg2) { } + + @Override + public void error(String msg, Object... arguments) { } + + @Override + public void error(String msg, Throwable t) { } + }; + + @Override + public Logger getLogger(String className) { + return NO_OP_LOGGER; + } + + @Override + public Logger getLogger(Class<?> clazz) { + return NO_OP_LOGGER; + } + } +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/annotations/Debug.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/annotations/Debug.java new file mode 100644 index 0000000000..b00b85a814 --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/annotations/Debug.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.api.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Created by TALIO on 12/26/2016. + */ + +public @interface Debug { + +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/annotations/Metrics.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/annotations/Metrics.java new file mode 100644 index 0000000000..2bcad91e38 --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/annotations/Metrics.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.api.annotations; + +/** + * Indicates a method whose execution time should be measured and logged as required for Open OPENECOMP metrics. + * + * @author evitaliy + * @since 27/07/2016. + */ + +public @interface Metrics { +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/context/ContextPropagationService.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/context/ContextPropagationService.java new file mode 100644 index 0000000000..98200da337 --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/context/ContextPropagationService.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.api.context; + +/** + * Should be used to implement a framework-specific mechanism of propagation of a diagnostic context to child threads. + * + * @author evitaliy + * @since 12/09/2016. + */ +public interface ContextPropagationService { + + Runnable create(Runnable task); +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/context/TaskFactory.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/context/TaskFactory.java new file mode 100644 index 0000000000..3ad999f272 --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/context/TaskFactory.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.api.context; + +import org.openecomp.sdc.logging.api.BaseFactory; + +/** + * <p>Should be used to propagate a diagnostic context (for instance + * <a href="http://www.slf4j.org/manual.html#mdc">MDC</a>) to other threads.</p> + * + * <p>Applicable when creating a child thread directly, or submitting tasks for potentially postponed execution via + * an <a href="http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executor.html">Executor</a> (including + * any of the <a href="http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html">executor + * services</a> and + * <a href="http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ForkJoinPool.html">ForkJoinPool</a>).</p> + * + * <p>The service used by this factory must implement {@link ContextPropagationService}.</p> + * + * @author evitaliy + * @since 12/09/2016. + * + * @see ContextPropagationService + */ +@SuppressWarnings("ThrowableInstanceNeverThrown") +public class TaskFactory extends BaseFactory { + + private static final ContextPropagationService SERVICE; + private static final RuntimeException ERROR; + + static { + + ContextPropagationService service = null; + RuntimeException error = null; + + try { + service = locateService(ContextPropagationService.class); + } catch (Throwable e) { + error = new RuntimeException("Failed to instantiate task factory", e); + } + + SERVICE = service; + ERROR = error; + } + + /** + * Modify a task so that a diagnostic context is propagated to the thread when the task runs. Done in a + * logging-framework specific way. + * + * @param task any Runnable that will run in a thread + * @return modified (wrapped) original task that runs the same business logic, but also takes care of copying the + * diagnostic context for logging + */ + public static Runnable create(Runnable task) { + + if (SERVICE == null) { + throw ERROR; + } + + return SERVICE.create(task); + } +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/context/MdcData.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/context/MdcData.java new file mode 100644 index 0000000000..a6a673d9dc --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/context/MdcData.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.context; + +import org.openecomp.sdc.logging.types.LoggerConstants; +import org.slf4j.MDC; + + +public abstract class MdcData { + private String level; + private String errorCode; + + MdcData() { + } + + public MdcData(String level, String errorCode) { + this.level = level; + this.errorCode = errorCode; + } + + public void setMdcValues() { + MDC.put(LoggerConstants.ERROR_CATEGORY, this.level); + MDC.put(LoggerConstants.ERROR_CODE, this.errorCode); + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/AuditMessages.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/AuditMessages.java new file mode 100644 index 0000000000..028a1bcb38 --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/AuditMessages.java @@ -0,0 +1,28 @@ +package org.openecomp.sdc.logging.messages; + +/** + * Created by ayalaben on 4/20/2017. + */ +public class AuditMessages { + + public static final String AUDIT_MSG = " --Audit-- "; + + public static final String CREATE_VLM = "Create VLM. VLM Name: "; + public static final String CHECK_IN_VLM = "Check in VLM. VLM Id: "; + public static final String CHECK_OUT_VLM = "Check out VLM. VLM Id: "; + public static final String SUBMIT_VLM = "submit VLM. VLM Name: "; + + public static final String CREATE_VSP = "Create VSP. VSP Name: "; + public static final String CHECK_IN_VSP = "Check in VSP. VSP Id: "; + public static final String CHECK_OUT_VSP = "Check out VSP. VSP Id: "; + public static final String SUBMIT_VSP = "Submit VSP. VSP Id: "; + + public static final String UPLOAD_HEAT = "Upload HEAT. VSP Id: "; + public static final String UPLOAD_PROCESS_ARTIFACT = "Upload Process Artifact. VSP Id: "; + public static final String UPLOAD_ARTIFACT_MIB_POLL = "Upload Artifact SNMP POLL. VSP Id: "; + public static final String UPLOAD_ARTIFACT_MIB_TRAP = "Upload Artifact SNMP TRAP. VSP Id: "; + + public static final String IMPORT_SUCCESS = "VSP import to VF success. VSP Id: "; + public static final String IMPORT_FAIL = "VSP import to VF fail. VSP Id: "; + +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/DebugMessages.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/DebugMessages.java new file mode 100644 index 0000000000..c3e5f977cc --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/DebugMessages.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.messages; + + +public class DebugMessages { + public static final String DEFAULT_ENTER_METHOD = "Entering %s"; + public static final String DEFAULT_EXIT_METHOD = "Exiting %s"; + + public static final String ENTER_METHOD = "Entering %s with %s = %s"; + public static final String EXIT_METHOD = "Exiting %s with %s = %s"; + + public static final String ENTER_METHOD_FORMATTED = "Entering %s with %s"; + public static final String EXIT_METHOD_FORMATTED = "Exiting %s with %s"; + +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/DebugConstants.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/DebugConstants.java new file mode 100644 index 0000000000..71884cff70 --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/DebugConstants.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.types; + +/** + * Created by TALIO on 1/10/2017. + */ +public class DebugConstants { + public static final String EXIT = "Exit"; + public static final String EXIT_DEFAULT = "Exit_Default"; + public static final String ENTER = "Enter"; + public static final String ENTER_DEFAULT = "Enter_Default"; + public static final String DEFAULT = "Default"; +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerConstants.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerConstants.java new file mode 100644 index 0000000000..0d591be095 --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerConstants.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.types; + + +public class LoggerConstants { + + public static final String REQUEST_ID = "RequestId"; + public static final String PARTNER_NAME = "PartnerName"; + public static final String SERVICE_NAME = "ServiceName"; + public static final String INSTANCE_UUID = "InstanceUUID"; + public static final String CATEGORY_LOG_LEVEL = "level"; + public static final String STATUS_CODE = "StatusCode"; + public static final String RESPONSE_CODE = "ResponseCode"; + public static final String RESPONSE_DESCRIPTION = "ResponseDescription"; + public static final String TARGET_SERVICE_NAME = "TargetServiceName"; + public static final String TARGET_ENTITY = "TargetEntity"; + public static final String TARGET_ENTITY_API = "API"; + public static final String TARGET_ENTITY_DB = "DB"; + public static final String ERROR_CATEGORY = "ErrorCategory"; + public static final String ERROR_CODE = "ErrorCode"; + public static final String ERROR_DESCRIPTION = "ErrorDescription"; +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerErrorCategory.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerErrorCategory.java new file mode 100644 index 0000000000..5addccde7d --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerErrorCategory.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.types; + + +public enum LoggerErrorCategory { + ERROR, + WARN, + DEBUG, + INFO, + FATAL; +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerErrorCode.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerErrorCode.java new file mode 100644 index 0000000000..141a1496f0 --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerErrorCode.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.types; + + +public enum LoggerErrorCode { + PERMISSION_ERROR("100"), + AVAILABILITY_ERROR("200"), + DATA_ERROR("300"), + SCHEMA_ERROR("400"), + BUSINESS_PROCESS_ERROR("500"), + UNKNOWN_ERROR("900"); + + private String errorCode; + + LoggerErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerErrorDescription.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerErrorDescription.java new file mode 100644 index 0000000000..16a7b430b8 --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerErrorDescription.java @@ -0,0 +1,109 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.types; + + +public class LoggerErrorDescription { + public static final String ARTIFACT_NOT_REFERENCED = "Artifact not referenced"; + public static final String WRONG_FILE_EXTENSION = "Wrong file extention"; + public static final String INVALID_HEAT_FORMAT = "Invalid HEAT format"; + public static final String PARAMETER_NOT_FOUND = "Referenced parameter not found"; + public static final String ENV_PARAMETER_NOT_IN_HEAT = "env includes parameter not in HEAT"; + public static final String PARAMETER_DEFAULT_VALUE_NOT_ALIGNED_WITH_TYPE = + "Parameter default value not alinged with type"; + public static final String INVALID_RESOURCE_TYPE = "Invalid resource type"; + public static final String INVALID_GET_RESOURCE_SYNTAX = "Invalid get resource syntax"; + public static final String RESOURCE_NOT_FOUND = "Resource not found"; + public static final String INVALID_INDEX_VAR = "Invalid Resource Group index var"; + public static final String MISSING_FILE = "Missing file"; + public static final String MISSING_NOVA_PROPERTIES = "Missing NOVA server properties"; + public static final String NESTED_LOOP = "Found nested loop"; + public static final String MISSING_PARAMETER_IN_NESTED = "Missing parameter in nested file"; + public static final String WRONG_VALUE_ASSIGNED_NESTED_PARAMETER = + "Wrong value assigned in nested parameters"; + public static final String SERVER_NOT_DEFINED_NOVA = "Server not defined from nova"; + public static final String WRONG_POLICY_SERVER_GROUP = "Wrong policy in server group"; + public static final String SERVER_GROUP_SECURITY_GROUP_NOT_IN_USE = + "Server group or security group is not in use"; + public static final String NETWORK_ATTACH_POLICY_NOT_IN_USE = + "Network Attach Policy is not in use"; + public static final String NO_BIND_FROM_PORT_TO_NOVA = "No bind from port to nova sever"; + public static final String PORT_BINDS_MORE_THAN_ONE_NOVA = + "Port binds to more than one nova sever"; + public static final String MISSING_RESOURCE_DEPENDS_ON = "Missing resource in depends_on"; + public static final String GET_ATTR_NOT_FOUND = "get_attr not found"; + public static final String MISSING_GET_PARAM = "Missing get_param"; + public static final String EMPTY_FILE = "Empty file"; + public static final String VALIDATE_FILE = "Can't validate file"; + public static final String INVALID_FILE_TYPE = "Invalid file type"; + public static final String INVALID_ZIP = "Invalid zip file"; + + + public static final String RESOURCE_UNIQUE_NETWORK_ROLE = + "Resource connects to two networks with the same role"; + public static final String NAME_NOT_ALIGNED_WITH_GUIDELINES = "Name not aligned with guidelines"; + public static final String VOLUME_FILE_NOT_EXPOSED = "Volume file not exposed"; + public static final String RESOURCE_NOT_DEFINED_AS_OUTPUT = "Resource is not defined as output"; + public static final String FLOATING_IP_IN_USE = "Floating IP resource type is in use"; + public static final String MISSING_BASE_HEAT = "Missing base HEAT file"; + public static final String MULTI_BASE_HEAT = "Multi base HEAT file"; + + public static final String EXTRACT_COMPOSITION_DATA = "Can't extract composition data"; + + public static final String MERGE_CONTRAIL_2_AND_3 = + "Merge of Contrail 2 and Contrail 3 resources"; + public static final String CONTRAIL_2_IN_USE = "Contrail 2 resource is in use"; + + public static final String INVALID_MANIFEST = "Invalid manifest file"; + + public static final String INVALID_YAML_FORMAT = "Invalid YAML format"; + + public static final String CREATE_SERVICE_ARTIFACT = "Can't create service artifact"; + public static final String CREATE_ENRICH_SERVICE_ARTIFACT = + "Can't create enriched service artifact"; + public static final String CREATE_SERVICE_TEMPLATE = "Can't create service template"; + public static final String CREATE_ENRICH_SERVICE_TEMPLATE = + "Can't create enriched service template"; + public static final String GET_SERVICE_MODEL = "Can't get service model"; + public static final String MISSING_MANDATORY_PROPERTY = "Missing mandatory property"; + public static final String INVALID_PROPERTY = "Invalid Property"; + public static final String INVALID_ADD_ACTION = "Invalid add action"; + public static final String UNSUPPORTED_ENTITY = "Unsupported entity"; + public static final String CREATE_CSAR = "Can't create CSAR file"; + public static final String PACK_ARTIFACTS = "Can't pack artifacts into CSAR file"; + + public static final String TRANSLATE_HEAT = "Can't translate HEAT file"; + public static final String RESOURCE_FILE_READ_ERROR = "Can't read resource file from class path."; + public static final String FAILED_TO_GENERATE_GLOBAL_TYPES = "Failed to generate globalTypes"; + + public static final String CHECKOUT_ENTITY = "Can't checkout versionable entity"; + public static final String SUBMIT_ENTITY = "Can't submit versionable entity"; + public static final String ENTITY_NOT_FOUND = "Versionable entity not found"; + public static final String INVALID_VALUE = "Invalid value"; + + public static final String UNSUPPORTED_OPERATION = "Unsupported operation"; + public static final String INVALID_JSON = "Invalid JSON format"; + + public static final String INSERT_INTO_APPLICATION_CONFIG = + "Can't insert value into application config table"; + + public static final String CANT_HEAL = "Can't perform healing operation"; +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerServiceName.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerServiceName.java new file mode 100644 index 0000000000..3fac9547d3 --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerServiceName.java @@ -0,0 +1,153 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.types; + + +public enum LoggerServiceName { + + Create_VLM, + Get_VLM, + Checkout_VLM, + Checkin_VLM, + Undo_Checkout_VLM, + Submit_VLM, + Update_VLM, + List_VLM, + + List_EP, + Create_EP, + Update_EP, + Get_EP, + Delete_EP, + + List_FG, + Create_FG, + Update_FG, + Get_FG, + Delete_FG, + + List_LA, + Create_LA, + Update_LA, + Get_LA, + Delete_LA, + + List_LKG, + Create_LKG, + Update_LKG, + Get_LKG, + Delete_LKG, + + List_VSPs, + List_Packages, + Create_VSP, + Get_VSP, + Checkout_VSP, + Checkin_VSP, + Undo_Checkout_VSP, + Submit_VSP, + Update_VSP, + Create_Package, + List_VSP, + Upload_File, + Get_Uploaded_File, + Get_Translated_File, + Get_Questionnaire_VSP, + Update_Questionnaire_VSP, + Get_Information_Artifact, + + + List_Component_Processes, + Delete_List_Component_Processes, + Create_Component_Processes, + Update_Component_Processes, + Get_Component_Processes, + Delete_Component_Processes, + Upload_File_Component_Processes, + Get_Uploaded_File_Component_Processes, + Delete_Uploaded_File_Component_Processes, + + List_Processes, + Delete_List_Processes, + Create_Processes, + Update_Processes, + Get_Processes, + Delete_Processes, + Upload_File_Processes, + Get_Uploaded_File_Processes, + Delete_Uploaded_File_Processes, + + List_Components, + Delete_List_Components, + Create_Component, + Update_Component, + Get_Component, + Delete_Component, + Get_Questionnaire_Component, + Update_Questionnaire_Component, + + Upload_MIB_File, + Delete_MIB_File, + List_MIB_Files, + + List_Network, + Create_Network, + Update_Network, + Get_Network, + Delete_Network, + + List_nics, + Delete_List_nics, + Create_nic, + Update_nic, + Get_nic, + Delete_nic, + Get_Questionnaire_nic, + Update_Questionnaire_nic, + + Create_Process, + Update_Process, + + Insert_To_ApplicationConfig_Table, + Get_From_ApplicationConfig_Table, + Get_List_From_ApplicationConfig_Table_By_Namespace, + + Get_List_Activity_Log, + + Validate, + Enrich, Delete_VSP, Get_Process_Artifact, Create_Entity, Checkout_Entity, Undo_Checkout_Entity, + Checkin_Entity, Submit_Entity, Get_Entity_Version, Delete_Entity, Undo_Delete_Entity, + Translate_Resource, Translate_HEAT, LoggerServiceName, Get_VSP_List, Delete_VLM, Update_Manifest, + + CREATE_COMPONENT_DEPENDENCY_MODEL, + GET_COMPONENT_DEPENDENCY_MODEL; + + public static String getServiceName(LoggerServiceName serviceName) { + return serviceName.name().replace("_", " "); + } + + @Override + public String toString(){ + return this.name().replace("_", " "); + } + + +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerTragetServiceName.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerTragetServiceName.java new file mode 100644 index 0000000000..b496d73d83 --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/types/LoggerTragetServiceName.java @@ -0,0 +1,186 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.logging.types; + + +public class LoggerTragetServiceName { + /*HEAT validator*/ + public static final String VALIDATE_HEAT_BASE_STRUCTURE = "Validate Heat Base Structure"; + public static final String VALIDATE_ARTIFACTS_EXISTENCE = "Validate Artifacts Existence"; + public static final String VALIDATE_RESOURCE_REFERENCE_EXISTENCE = + "Validate Resource Reference Existence"; + public static final String VALIDATE_PARAMETER_REFERENCE_EXITENCE = + "Validate Parameter Reference Existence"; + public static final String VALIDATE_GET_ATTR_FROM_NESTED = "Validate get_attr From Nested"; + public static final String VALIDATE_ENV_FILE = "Validate env File"; + public static final String VALIDATE_BASE_PORTS_EXISTENCE = "Validate Base Ports Existence"; + public static final String VALIDATE_ASSIGNED_VALUES_FOR_NOVA_IMAGE_FLAVOR = + "Validate Assigned Value For Nova Server Image Or Flavor"; + public static final String VALIDATE_NOVA_SERVER_PORT_BINDING = + "Validate Ports Binding From Nova Server"; + public static final String VALIDATE_SERVER_GROUP_EXISTENCE = + "Validate Nova Server Group Existence"; + public static final String VALIDATE_PROPERTIES_MATCH_NESTED_PARAMETERS = + "Validate All Properties Match Nested Parameters"; + public static final String VALIDATE_NESTING_LOOPS = "Validate Nested Loops"; + public static final String VALIDATE_NOVA_SEVER_GROUP_POLICY = "Validate Nova Server Group Policy"; + public static final String VALIDATE_RESOURCE_GROUP_TYPE = "Validate Resource Group Resource Type"; + public static final String VALIDATE_ALL_SECURITY_GROUP_USED = + "Validate All Security Group Are Used From Neutron Port Resource"; + public static final String VALIDATE_CONTRAIL_ATTACH_POLICY_TYPE = + "Validate Contrail Attach Policy Type"; + public static final String VALIDATE_SECURITY_GROUP_FROM_BASE_OUTPUT = + "Validate Security Groups From Base File Outputs"; + public static final String CHECK_FOR_ORPHAN_PORTS = "Validate All Referenced Ports Are Used"; + public static final String CHECK_FOR_ORPHAN_ARTIFACTS = "Validate All Artifacts Are Referenced"; + public static final String CHECK_FOR_VALID_FILE_EXTENTION = "Validate File Extention"; + public static final String VALIDATE_PARAMTER_DEFAULT_MATCH_TYPE = + "Validate Parameter Default Aligns With Type"; + public static final String VALIDATE_ENV_PARAMETER_MATCH_TYPE = + "Validate env Parameter Matches Type"; + public static final String VALIDATE_RESOURCE_TYPE = "Validate Resource Type"; + public static final String VALIDATE_FILE_EXISTENCE = "Validate File Exitence"; + public static final String GET_RESOURCE_LIST_BY_TYPE = + "Get All Resources By Specific Resource Type"; + public static final String VALIDATE_ALL_SERVER_GROUP_OR_SECURITY_GROUP_IN_USE = + "Validate All Security Group Or Server Group Are In Use"; + public static final String VALIDATE_ATTACH_POLICY_IN_USE = + "Validate All Network Attach Policies Are In Use"; + public static final String CHECK_RESOURCE_DEPENDS_ON = "Check Resource dependes_on"; + public static final String GET_SHARED_RESOURCES_FROM_OUTPUTS = + "Get Shared Resources From Outputs"; + public static final String VALIDATE_GET_RESOURCE = "Validate get_resource Syntax"; + public static final String VALIDATE_FILE = "Validate File"; + + /*manifest validator*/ + public static final String VALIDATE_MANIFEST_CONTENT = "Validate Manifest Content"; + public static final String VALIDATE_FILE_IN_ZIP = "Validate File In Zip"; + public static final String VALIDATE_FILE_IN_MANIFEST = "Validate File In Manifest"; + public static final String VALIDATE_FILE_TYPE_AND_NAME = + "Validate File Type And Name In Manifest"; + public static final String SCAN_MANIFEST_STRUCTURE = "Scan Manifest Structure"; + public static final String VALIDATE_FILE_TYPE = "Validate File Type"; + + /*YAML validator*/ + public static final String VALIDATE_YAML_CONTENT = "Validate YAML Content"; + + + /*OPENECOMP guide line validator*/ + public static final String VALIDATE_BASE_FILE = + "Validate If All Resources In Base File Are Exposed"; + public static final String VALIDATE_FORBIDDEN_RESOURCE = "Validate If Resource Type Is Forbidden"; + public static final String VALIDATE_FIXED_IPS_NAME = "Validate fixed_ips Naming Convention"; + public static final String VALIDATE_IMAGE_AND_FLAVOR_NAME = + "Validate image And flavor Naming Convention"; + public static final String VALIDATE_NOVA_SERVER_NAME = "Validate Nova Server Naming Convention"; + public static final String VALIDATE_AVAILABILITY_ZONE_NAME = + "Validate availability_zone Naming Convention"; + public static final String VALIDATE_NOVA_META_DATA_NAME = + "Validate Nova Server Meta Data Naming Convention"; + public static final String VALIDATE_PORT_NETWORK_NAME = "Validate Port Network Naming Convention"; + public static final String VALIDATE_VM_SYNC_IN_IMAGE_FLAVOR = + "Validate VM Name Is Sync In Image And Flavor"; + public static final String VALIDATE_RESOURCE_NETWORK_UNIQUE_ROLW = + "Validate Nova Server Unique Role"; + public static final String VALIDATE_VOLUME_FILE = "Validate HEAT Volume File"; + + + public static final String VALIDATE_CONTRAIL_VM_NAME = + "Validate Contrail VM Name Aligned With Guidelines"; + public static final String MERGE_OF_CONTRAIL_2_AND_3 = "Merge Of Contrail 2 And Contrail 3"; + public static final String CONTRAIL_2_IN_USE = "Validate Contrail 2 Resource Is In Use"; + + + public static final String VALIDATE_MANIFEST_PRE_CONDITION = "Validate Manifest Pre-Condition"; + public static final String VALIDATE_HEAT_FORMAT = "Validate HEAT Format"; + + public static final String CREATE_ENTITY = "Create Entity"; + public static final String CHECKOUT_ENTITY = "Checkout Entity"; + public static final String UNDO_CHECKOUT_ENTITY = "Undo Checkout Entity"; + public static final String CHECKIN_ENTITY = "Checkin Entity"; + public static final String SUBMIT_ENTITY = "Submit Entity"; + public static final String DELETE_ENTITY = "Delete Entity"; + public static final String UNDO_DELETE_ENTITY = "Undo Delete Entity"; + + public static final String SUBMIT_VSP = "Submit VSP"; + public static final String GET_VSP = "Get VSP"; + public static final String DELETE_VSP = "Delete VSP"; + public static final String ENRICH = "Enrich"; + public static final String UPLOAD_FILE = "Upload file"; + public static final String GET_UPLOADED_HEAT = "Get Uploaded HEAT File"; + public static final String GET_TRANSLATED_FILE = "Get Translated File"; + public static final String CREATE_TRANSLATED_FILE = "Create Translated File"; + public static final String CREATE_PACKAGE = "Create Package"; + + public static final String SELF_HEALING = "Self Healing"; + public static final String WRITE_ARTIFACT_XML = "Write Artifact To XML File"; + + public static final String GET_VLM = "Get VLM"; + + public static final String VALIDATE_MIB = "Validate MIB File"; + public static final String UPLOAD_MIB = "Upload MIB file"; + + public static final String GET_VERSION_INFO = "Get version info"; + + public static final String CREATE_NETWORK = "Create Network"; + public static final String DELETE_NETWORK = "Delete Network"; + + public static final String CREATE_COMPONENT = "Create Component"; + public static final String DELETE_COMPONENT = "Delete Component"; + + public static final String GET_PROCESS_ARTIFACT = "Get Process Artifact"; + public static final String UPLOAD_PROCESS_ARTIFACT = "Upload Process Artifact"; + + public static final String CREATE_NIC = "Create Nic"; + public static final String DELETE_NIC = "Delete Nic"; + + public static final String EXTRACT_COMPOSITION_DATA = "Extract Composition Data"; + + public static final String TRANSLATE_RESOURCE = "Translate Resource"; + public static final String GET_RESOURCE = "Get Resource"; + public static final String VALIDATE_HEAT_BEFORE_TRANSLATE = "Validate HEAT Before Translate"; + + public static final String CREATE_SERVICE_ARTIFACT = "Create Service Artifact In DB"; + public static final String CREATE_SERVICE_ENRICH_ARTIFACT = + "Create Service Enriched Artifact In DB"; + public static final String CREATE_SERVICE_TEMPLATE = "Create Service Template In DB"; + public static final String CREATE_ENRICH_SERVICE_TEMPLATE = + "Create Enriched Service Template In DB"; + public static final String GET_SERVICE_MODEL = "Get service model"; + public static final String GET_SERVICE_TEMPLATE = "Get Service Template"; + public static final String CREATE_REQUIREMENT_ASSIGNMENT = "Create Requierment Assignment"; + public static final String GENERATE_TRANSLATED_ID = "Generate Translated Id"; + public static final String ADD_ENTITIES_TO_TOSCA = "Add Entities To TOSCA"; + public static final String CREATE_CSAR = "Create CSAR"; + public static final String PACK_ARTIFACTS = "Pack Artifacts Into CSAR File"; + + public static final String VALIDATE_CHOICE_VALUE = "Check Chosen Value"; + + public static final String INSERT_INTO_APPLICATION_CONFIG = + "Insert Value Into Application Config"; + + public static final String VALIDATE_FILE_DATA_STRUCTURE = "Validate Manifest Sent From User"; + + public static final String CREATE_COMPONENT_DEPENDENCY_MODEL = "Create Component Dependency " + + "Model"; + + public static final String READ_RESOURCE_FILE = "Read Resource File"; +} diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/resources/factoryConfiguration.json new file mode 100644 index 0000000000..33163b32bb --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/resources/factoryConfiguration.json @@ -0,0 +1,3 @@ +{ + "org.openecomp.sdc.logging.api.BaseFactory": "org.openecomp.sdc.logging.api.LoggerFactory" +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/resources/logback.xml b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/resources/logback.xml new file mode 100644 index 0000000000..8eb22bda96 --- /dev/null +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/resources/logback.xml @@ -0,0 +1,284 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration scan="true" scanPeriod="5 seconds"> + + <property scope="system" name="OPENECOMP-component-name" value="ASDC" /> + <property scope="system" name="OPENECOMP-subcomponent-name" value="ASDC-BE" /> + <property file="${config.home}/catalog-be/configuration.yaml" /> + <property scope="context" name="enable-all-log" value="false" /> + + <!--statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> + <include resource="asdc_debug_logback.xml"/--> + + <!-- value used by pattern field list (| - is inter-field separator, || - unavailable or not applicable field value) (m - mandatory, o- optional)--> + <!--timestamp(m)| requestID(m)| serviceInstanceID(o)| threadID(m)| physicalServerName(o)| serviceName(m)| userID(m)| logLevel(m)| severity(o)| serverIpAddress(m)| serverName(m)| clientIpAddress(o)| className(m)| timer(o)| detailedMessage(o)--> + <property name="default-log-pattern" + value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{uuid}|%X{serviceInstanceID}|%thread||${OPENECOMP-subcomponent-name}|%X{userId}|%level|%X{alarmSeverity}|%X{localAddr}|${beFqdn}|%X{remoteAddr}|%logger{35}|%X{timer}|ActivityType=<%M>, Desc=<%msg>%n" /> + + <property name="asdc-debug-log-pattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%msg %n"/> + + <!-- All log --> + <if condition='property("enable-all-log").equalsIgnoreCase("true")'> + <then> + <appender name="ALL_ROLLING" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/all.log + </file> + + <rollingPolicy + class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/all.log.%i + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>20MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${default-log-pattern}</pattern> + </encoder> + </appender> + + <appender name="ASYNC_ALL" class="ch.qos.logback.classic.AsyncAppender"> + <appender-ref ref="ALL_ROLLING" /> + </appender> + </then> + </if> + + <!-- Error log --> + <appender name="ERROR_ROLLING" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/Error.log + </file> + + <!-- Audit messages filter - deny audit messages --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>AUDIT_MARKER</marker> + </evaluator> + <onMismatch>NEUTRAL</onMismatch> + <onMatch>DENY</onMatch> + </filter> + + <!-- Transaction messages filter - deny Transaction messages --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>TRANSACTION_MARKER</marker> + </evaluator> + <onMismatch>NEUTRAL</onMismatch> + <onMatch>DENY</onMatch> + </filter> + + <!-- deny all events with a level below INFO, that is TRACE and DEBUG --> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/Error.log.%i + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>20MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${default-log-pattern}</pattern> + </encoder> + </appender> + + <!-- Debug log --> + <appender name="DEBUG_ROLLING" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug.log + </file> + + <!-- No need to deny audit messages - they are INFO only, will be denied + anyway --> + <!-- Transaction messages filter - deny Transaction messages, there are + some DEBUG level messages among them --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>TRANSACTION_MARKER</marker> + </evaluator> + <onMismatch>NEUTRAL</onMismatch> + <onMatch>DENY</onMatch> + </filter> + + <!-- accept DEBUG and TRACE level --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator"> + <expression> + e.level.toInt() <= DEBUG.toInt() + </expression> + </evaluator> + <OnMismatch>DENY</OnMismatch> + <OnMatch>NEUTRAL</OnMatch> + </filter> + + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug.log.%i + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>20MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${default-log-pattern}</pattern> + </encoder> + </appender> + + <!-- Debug log --> + <appender name="PACKAGE_DEBUG_ROLLING" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug_by_package.log + </file> + + <!-- No need to deny audit messages - they are INFO only, will be denied + anyway --> + <!-- Transaction messages filter - deny Transaction messages, there are + some DEBUG level messages among them --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>TRANSACTION_MARKER</marker> + </evaluator> + <onMismatch>NEUTRAL</onMismatch> + <onMatch>DENY</onMatch> + </filter> + + <!-- accept DEBUG and TRACE level --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator"> + <expression> + e.level.toInt() <= DEBUG.toInt() + </expression> + </evaluator> + <OnMismatch>DENY</OnMismatch> + <OnMatch>NEUTRAL</OnMatch> + </filter> + + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug_by_package.log.%i + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>20MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${asdc-debug-log-pattern}</pattern> + </encoder> + </appender> + + <!-- Audit log --> + <appender name="AUDIT_ROLLING" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + + <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/audit.log + </file> + + <!-- Audit messages filter - accept audit messages --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>AUDIT_MARKER</marker> + </evaluator> + <onMismatch>DENY</onMismatch> + <onMatch>ACCEPT</onMatch> + </filter> + + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/audit.log.%i + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>20MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${default-log-pattern}</pattern> + </encoder> + </appender> + + <!-- SdncTransaction log --> + <appender name="TRANSACTION_ROLLING" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + + <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/transaction.log + </file> + + <!-- Transaction messages filter - accept audit messages --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>TRANSACTION_MARKER</marker> + </evaluator> + <onMismatch>DENY</onMismatch> + <onMatch>ACCEPT</onMatch> + </filter> + + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/transaction.log.%i + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>20MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${default-log-pattern}</pattern> + </encoder> + </appender> + + <!-- Asynchronicity Configurations --> + <appender name="ASYNC_DEBUG" class="ch.qos.logback.classic.AsyncAppender"> + <appender-ref ref="DEBUG_ROLLING" /> + </appender> + + <appender name="ASYNC_TRANSACTION" class="ch.qos.logback.classic.AsyncAppender"> + <appender-ref ref="TRANSACTION_ROLLING" /> + </appender> + + <appender name="ASYNC_ERROR" class="ch.qos.logback.classic.AsyncAppender"> + <appender-ref ref="ERROR_ROLLING" /> + </appender> + + + <root level="INFO"> + <appender-ref ref="ASYNC_ERROR" /> + <appender-ref ref="ASYNC_DEBUG" /> + <appender-ref ref="AUDIT_ROLLING" /> + <appender-ref ref="ASYNC_TRANSACTION" /> + <if condition='property("enable-all-log").equalsIgnoreCase("true")'> + <then> + <appender-ref ref="ALL_ROLLING" /> + </then> + </if> + </root> + + <logger name="org.openecomp.sdc" level="INFO" /> + + <logger name="org.openecomp.sdc.vendorsoftwareproduct" level="DEBUG" additivity ="false"> + <appender-ref ref="PACKAGE_DEBUG_ROLLING" /> + </logger> + + <logger name="org.openecomp.sdc.vendorlicense" level="DEBUG" additivity ="false"> + <appender-ref ref="PACKAGE_DEBUG_ROLLING" /> + </logger> +</configuration>
\ No newline at end of file |