Added AAF filters and Observations 77/78877/3
authorJerry Flood <jflood@att.com>
Wed, 20 Feb 2019 21:01:49 +0000 (16:01 -0500)
committerJerry Flood <jflood@att.com>
Tue, 26 Feb 2019 22:20:14 +0000 (17:20 -0500)
AAF profile not configured

Issue-ID: OPTFRA-390
Change-Id: I38a72951507ae768eeace2c67c2632812bf4f8aa
Signed-off-by: Jerry Flood <jflood@att.com>
45 files changed:
cmso-service/etc/config/cadi.properties [new file with mode: 0644]
cmso-service/etc/config/cmso.properties
cmso-service/pom.xml
cmso-service/src/main/docker/assembly/cmso-files.xml
cmso-service/src/main/docker/extra-files/startService.sh
cmso-service/src/main/docker/extra-files/startService.sh.bak [new file with mode: 0644]
cmso-service/src/main/java/org/onap/observations/Mdc.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/observations/Observation.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/observations/ObservationInterface.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/observations/ObservationObject.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/AuthProvider.java
cmso-service/src/main/java/org/onap/optf/cmso/SecurityConfig.java
cmso-service/src/main/java/org/onap/optf/cmso/SpringProfiles.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafAuthorizationFilter.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafFilter.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafPerm.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafSecurityConfig.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafUserRole.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafUserRoleProperties.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/aaf/FilterPriority.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/aaf/ResponseFormatter.java [new file with mode: 0644]
cmso-service/src/main/java/org/onap/optf/cmso/common/LogMessages.java
cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java
cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java
cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmQuartzJob.java
cmso-service/src/main/java/org/onap/optf/cmso/filters/CMSOClientFilters.java
cmso-service/src/main/java/org/onap/optf/cmso/filters/CMSOContainerFilters.java
cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CMSOptimizerClient.java
cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java
cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java
cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSCallbackImpl.java
cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOServiceImpl.java
cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java
cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java
cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java
cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java
cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmClient.java
cmso-service/src/main/resources/aaf/AAFUserRoles.properties [new file with mode: 0644]
cmso-service/src/main/resources/aaf/org.onap.oof.cred.props [new file with mode: 0644]
cmso-service/src/main/resources/aaf/org.onap.oof.keyfile [new file with mode: 0644]
cmso-service/src/main/resources/aaf/org.onap.oof.location.props [new file with mode: 0644]
cmso-service/src/main/resources/aaf/org.onap.oof.props [new file with mode: 0644]
cmso-service/src/main/resources/aaf/truststoreONAPall.jks [new file with mode: 0644]
cmso-service/src/main/resources/application.properties
cmso-service/src/main/resources/logmessages.properties

diff --git a/cmso-service/etc/config/cadi.properties b/cmso-service/etc/config/cadi.properties
new file mode 100644 (file)
index 0000000..5135d1d
--- /dev/null
@@ -0,0 +1,4 @@
+
+cadi_loglevel=DEBUG
+cadi_prop_files=src/main/resources/aaf/org.onap.oof.props
+
index f103c57..d4a78e8 100644 (file)
@@ -90,15 +90,13 @@ org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore
 loopback.mso.requestId=dummy123\r
 \r
 so.polling.interval.ms=10000\r
-#mso.user=cmso@onap.org\r
-#mso.pass=enc:bfodXf8qRfCqMvlxVBYNWQ==\r
 \r
 ## loopback settings\r
 so.url=http://localhost:8080/cmso/v1/loopbacktest/onap/so/infra/orchestrationRequests/v7\r
-so.user=cmso@onap.org\r
-so.pass=enc:bfodXf8qRfCqMvlxVBYNWQ==\r
+so.user=oof@oof.onap.org\r
+so.pass=enc:vfxQdJ1mgdcI7S6SPrzNaw==\r
 \r
-mechid.user=cmso@onap.org\r
-mechid.pass=enc:bfodXf8qRfCqMvlxVBYNWQ==\r
+mechid.user=oof@oof.onap.org\r
+mechid.pass=enc:vfxQdJ1mgdcI7S6SPrzNaw==\r
 \r
 cmso.dispatch.url=http://localhost:8089\r
index 42ec87e..d03a3ac 100644 (file)
@@ -1,45 +1,37 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
-<!-- \r
- Copyright © 2017-2018 AT&T Intellectual Property.\r
- Modifications Copyright © 2018 IBM.\r
\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
\r
-         http://www.apache.org/licenses/LICENSE-2.0\r
\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
\r
\r
- Unless otherwise specified, all documentation contained herein is licensed\r
- under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
- you may not use this documentation except in compliance with the License.\r
- You may obtain a copy of the License at\r
\r
-         https://creativecommons.org/licenses/by/4.0/\r
\r
- Unless required by applicable law or agreed to in writing, documentation\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
+<!--\r
+\r
+    ============LICENSE_START=======================================================\r
+    org.onap.optf.cmso\r
+    ================================================================================\r
+    Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved.\r
+    ================================================================================\r
+    Licensed under the Apache License, Version 2.0 (the "License");\r
+    you may not use this file except in compliance with the License.\r
+    You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+    Unless required by applicable law or agreed to in writing, software\r
+    distributed under the License is distributed on an "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+    See the License for the specific language governing permissions and\r
+    limitations under the License.\r
+    ============LICENSE_END=========================================================\r
+\r
 -->\r
 \r
+\r
 <project xmlns="http://maven.apache.org/POM/4.0.0"\r
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
        <modelVersion>4.0.0</modelVersion>\r
 \r
-    <parent>\r
-        <groupId>org.onap.optf.cmso</groupId>\r
-        <artifactId>cmso</artifactId>\r
-        <version>1.0.1-SNAPSHOT</version>\r
-    </parent>\r
+       <parent>\r
+               <groupId>org.onap.optf.cmso</groupId>\r
+               <artifactId>cmso</artifactId>\r
+               <version>1.0.1-SNAPSHOT</version>\r
+       </parent>\r
 \r
        <groupId>org.onap.optf.cmso</groupId>\r
        <artifactId>cmso-service</artifactId>\r
 \r
        <properties>\r
                <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>\r
-       \r
+\r
                <cmso.project.version>${project.version}</cmso.project.version>\r
                <cmso.build.timestamp>${maven.build.timestamp}</cmso.build.timestamp>\r
-               \r
+\r
                <service.name>cmso</service.name>\r
                <release-tag>Casablanca</release-tag>\r
                <name.space>org.onap.optf.cmso</name.space>\r
@@ -74,6 +66,7 @@
                <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>\r
                <mariadb.version>2.2.1</mariadb.version>\r
                <swagger.directory>${basedir}/src/main/resources/swagger-ui/dist</swagger.directory>\r
+        <aaf.version>2.1.4</aaf.version>\r
 \r
                <!-- Sonar -->\r
                <ilib.version>2.0.7</ilib.version>\r
                        <artifactId>springfox-swagger-ui</artifactId>\r
                        <version>${springfox.swagger2.version}</version>\r
                </dependency>\r
-               <!-- <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> \r
-                       </dependency> -->\r
                <dependency>\r
                        <groupId>org.quartz-scheduler</groupId>\r
                        <artifactId>quartz</artifactId>\r
                </dependency>\r
 \r
                <dependency>\r
-               <groupId>joda-time</groupId>\r
-               <artifactId>joda-time</artifactId>\r
-               <version>2.8.1</version>\r
-               </dependency>\r
+                       <groupId>joda-time</groupId>\r
+                       <artifactId>joda-time</artifactId>\r
+                       </dependency>\r
                <dependency>\r
-               <groupId>org.apache.commons</groupId>\r
-               <artifactId>commons-lang3</artifactId>\r
-               <version>3.8.1</version>\r
+                       <groupId>org.apache.commons</groupId>\r
+                       <artifactId>commons-text</artifactId>\r
+                       <version>1.6</version>\r
                </dependency>\r
                <!-- Testing Dependencies -->\r
                <!-- <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-api-mockito2</artifactId> \r
                        <groupId>org.jacoco</groupId>\r
                        <artifactId>jacoco-maven-plugin</artifactId>\r
                        <version>0.8.1</version>\r
-            <scope>test</scope>\r
+                       <scope>test</scope>\r
+               </dependency>\r
+               <dependency>\r
+                       <groupId>org.onap.aaf.authz</groupId>\r
+                       <artifactId>aaf-cadi-aaf</artifactId>\r
+                       <version>${aaf.version}</version>\r
                </dependency>\r
        </dependencies>\r
 \r
                                                </configuration>\r
                                        </execution>\r
                                </executions>\r
-                       </plugin>                       \r
+                       </plugin>\r
                        <plugin>\r
                                <artifactId>exec-maven-plugin</artifactId>\r
                                <groupId>org.codehaus.mojo</groupId>\r
                                </executions>\r
                        </plugin>\r
                        <plugin>\r
-                               <groupId>io.fabric8</groupId>\r
-                               <artifactId>docker-maven-plugin</artifactId>\r
-                               <version>0.26.0</version>\r
-                               <configuration>\r
-                                       <verbose>true</verbose>\r
-                                       <apiVersion>1.23</apiVersion>\r
-                                       <images>\r
-                                                               <image>\r
-                                                                               <name>onap/optf-cmso-service</name>\r
-                                                                               <alias>onap-optf-cmso-service</alias>\r
-                                                                               <build>\r
-                                                                                               <cleanup>true</cleanup>\r
-                                                                                               <tags>\r
-                                                                                                               <tag>latest</tag>\r
-                                                                                                               <tag>${project.docker.latesttagtimestamp.version}</tag>\r
-                                                                                                               <tag>${project.docker.latesttag.version}</tag>                                                                                          \r
-                                                                                               </tags>\r
-                                                                                               <dockerFile>${project.basedir}/src/main/docker/Dockerfile</dockerFile>\r
-                                                                                               <assembly>\r
-                                                                                                               <descriptor>${project.basedir}/src/main/docker/assembly/cmso-files.xml</descriptor>\r
-                                                                                                               <name>onap-cmso</name>\r
-                                                                                               </assembly>\r
-                                                                               </build>\r
-                                                               </image>\r
-                                       </images>\r
-                               </configuration>\r
-                               <executions>\r
-                                       <execution>\r
-                                               <id>generate-images</id>\r
-                                               <phase>install</phase>\r
-                                               <goals>\r
-                                                       <goal>build</goal>\r
-                                               </goals>\r
-                                       </execution>\r
-                                       <execution>\r
-                                               <id>push-images</id>\r
-                                               <phase>deploy</phase>\r
-                                               <goals>\r
-                                                       <goal>build</goal>\r
-                                                       <goal>push</goal>\r
-                                               </goals>\r
-                                               <configuration>\r
-                                                       <image>onap/optf-cmso-service:%l</image>\r
-                                               </configuration>\r
-                                       </execution>\r
-                               </executions>\r
+                               <groupId>io.fabric8</groupId>\r
+                               <artifactId>docker-maven-plugin</artifactId>\r
+                               <version>0.26.0</version>\r
+                               <configuration>\r
+                                       <verbose>true</verbose>\r
+                                       <apiVersion>1.23</apiVersion>\r
+                                       <images>\r
+                                               <image>\r
+                                                       <name>onap/optf-cmso-service</name>\r
+                                                       <alias>onap-optf-cmso-service</alias>\r
+                                                       <build>\r
+                                                               <cleanup>true</cleanup>\r
+                                                               <tags>\r
+                                                                       <tag>latest</tag>\r
+                                                                       <tag>${project.docker.latesttagtimestamp.version}</tag>\r
+                                                                       <tag>${project.docker.latesttag.version}</tag>\r
+                                                               </tags>\r
+                                                               <dockerFile>${project.basedir}/src/main/docker/Dockerfile</dockerFile>\r
+                                                               <assembly>\r
+                                                                       <descriptor>${project.basedir}/src/main/docker/assembly/cmso-files.xml</descriptor>\r
+                                                                       <name>onap-cmso</name>\r
+                                                               </assembly>\r
+                                                       </build>\r
+                                               </image>\r
+                                       </images>\r
+                               </configuration>\r
+                               <executions>\r
+                                       <execution>\r
+                                               <id>generate-images</id>\r
+                                               <phase>install</phase>\r
+                                               <goals>\r
+                                                       <goal>build</goal>\r
+                                               </goals>\r
+                                       </execution>\r
+                                       <execution>\r
+                                               <id>push-images</id>\r
+                                               <phase>deploy</phase>\r
+                                               <goals>\r
+                                                       <goal>build</goal>\r
+                                                       <goal>push</goal>\r
+                                               </goals>\r
+                                               <configuration>\r
+                                                       <image>onap/optf-cmso-service:%l</image>\r
+                                               </configuration>\r
+                                       </execution>\r
+                               </executions>\r
                        </plugin>\r
                </plugins>\r
                <!-- mention the logback.xml location through system property or environment \r
                                        <include>**/*</include>\r
                                </includes>\r
                        </resource>\r
+                       <resource>\r
+                               <directory>etc/config</directory>\r
+                               <filtering>true</filtering>\r
+                               <includes>\r
+                                       <include>**/*</include>\r
+                               </includes>\r
+                       </resource>\r
                        <resource>\r
                                <directory>${basedir}/truststore</directory>\r
                                <targetPath>${basedir}/target/truststore</targetPath>\r
index 2dd3a16..6dcf422 100644 (file)
@@ -1,22 +1,13 @@
-<!--
-  ============LICENSE_START=======================================================
-  ECOMP CMSO
-  ================================================================================
-  Copyright (C) 2018 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=========================================================
-  -->
+<!-- ============LICENSE_START======================================================= 
+       ECOMP CMSO ================================================================================ 
+       Copyright (C) 2018 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========================================================= -->
 
 <assembly
        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1"
                        <directory>data</directory>
                        <outputDirectory>/data</outputDirectory>
                </fileSet>
+               <fileSet>
+                       <directory>${project.basedir}/src/main/resources</directory>
+                       <outputDirectory>./resources</outputDirectory>
+                       <includes>
+                               <include>**/*</include>
+                       </includes>
+               </fileSet>
+               <fileSet>
+                       <directory>${project.basedir}/etc/config</directory>
+                       <outputDirectory>./</outputDirectory>
+                       <includes>
+                               <include>**/*</include>
+                       </includes>
+               </fileSet>
+
        </fileSets>
 
 </assembly>
index dbd111f..199c637 100644 (file)
@@ -1,4 +1,7 @@
 #!/bin/sh
+
+VM_ARGS="${VM_ARGS} -Dserver.local.startpath=${RESOURCES_HOME}"
+
 echo "VM_ARGS="${VM_ARGS}
 
 java -Djava.security.egd=file:/dev/./urandom  ${VM_ARGS} -Xms256m -Xmx1024m  -jar  ./app.jar
diff --git a/cmso-service/src/main/docker/extra-files/startService.sh.bak b/cmso-service/src/main/docker/extra-files/startService.sh.bak
new file mode 100644 (file)
index 0000000..dbd111f
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+echo "VM_ARGS="${VM_ARGS}
+
+java -Djava.security.egd=file:/dev/./urandom  ${VM_ARGS} -Xms256m -Xmx1024m  -jar  ./app.jar
diff --git a/cmso-service/src/main/java/org/onap/observations/Mdc.java b/cmso-service/src/main/java/org/onap/observations/Mdc.java
new file mode 100644 (file)
index 0000000..b00bed3
--- /dev/null
@@ -0,0 +1,248 @@
+/*
+ * Copyright © 2019 AT&T Intellectual Property.
+ * 
+ * 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.
+ * 
+ * 
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *         https://creativecommons.org/licenses/by/4.0/
+ * 
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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.
+*/
+package org.onap.observations;
+
+import static com.att.eelf.configuration.Configuration.MDC_BEGIN_TIMESTAMP;
+import static com.att.eelf.configuration.Configuration.MDC_END_TIMESTAMP;
+import static com.att.eelf.configuration.Configuration.MDC_INSTANCE_UUID;
+import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
+import static com.att.eelf.configuration.Configuration.MDC_PARTNER_NAME;
+import static com.att.eelf.configuration.Configuration.MDC_REMOTE_HOST;
+import static com.att.eelf.configuration.Configuration.MDC_RESPONSE_CODE;
+import static com.att.eelf.configuration.Configuration.MDC_RESPONSE_DESC;
+import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN;
+import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS;
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_INSTANCE_ID;
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
+import static com.att.eelf.configuration.Configuration.MDC_STATUS_CODE;
+import static com.att.eelf.configuration.Configuration.MDC_TARGET_ENTITY;
+import static com.att.eelf.configuration.Configuration.MDC_TARGET_SERVICE_NAME;
+
+import java.net.InetAddress;
+import java.net.URI;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response.StatusType;
+
+import org.onap.optf.cmso.filters.MessageHeaders.HeadersEnum;
+import org.quartz.JobExecutionContext;
+import org.slf4j.MDC;
+
+import com.att.eelf.utils.Stopwatch;
+
+/**
+ * ECOMP EELF logging MDC fields not defined in the MDC Configuration (i.e.
+ * MDC_ALERT_SEVERITY)
+ **/
+public class Mdc {
+       public static final String SERVICE_NAME = "CSS-Scheduler";
+       public enum Enum {
+               // BeginTimestamp,
+               // EndTimeStamp,
+               // RequestId,
+               // ServiceInstanceId,
+               VirtualServerName,
+               // ServiceName,
+               // PartnerName,
+               // StatusCOde,
+               // ResponseCode,
+               // ResponseDescription,
+               // InstanceUUID,
+               // AlertSeverity,
+               // ServerIPAddress,
+               // ElapsedTime,
+               // ServerFQDN,
+               // RemoteHost,
+               ClassName, Unused,
+               // ProcessKey,
+               CustomField1, CustomField2, CustomField3, CustomField4,
+               // TargetVirtualEntity,
+               // TargetEntity,
+               // TargetServiceName,
+               ErrorCode, ErrorDescription, Timer,
+       }
+
+       public static String getCaller(int back)
+       {
+               StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
+               return stackTraceElements[back].getClassName() + "." + stackTraceElements[back].getMethodName();
+       }
+
+       public static void setCaller(int back)
+       {
+               String caller = MDC.get(Enum.ClassName.name());
+               if (caller == null)
+                       MDC.put(Enum.ClassName.name(), getCaller(back));
+       }
+
+       public static void setObservation(ObservationInterface o)
+       {
+               MDC.put(Enum.CustomField4.name(), o.name());
+       }
+
+       public static void clearCaller()
+       {
+               MDC.remove(Enum.ClassName.name());
+       }
+
+       public static void quartzJobBegin(JobExecutionContext context) 
+       {
+               MDC.clear();
+               MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
+               MDC.put(MDC_INSTANCE_UUID, UUID.randomUUID().toString());
+               try{  MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName()); } catch (Exception e){ MDC.put(MDC_SERVER_FQDN, e.getMessage());}
+               try{  MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress()); } catch (Exception e){ MDC.put(MDC_SERVER_FQDN, e.getMessage());}
+               MDC.put(MDC_SERVICE_INSTANCE_ID, "UNKNOWN");
+               MDC.put(MDC_SERVICE_NAME, SERVICE_NAME);
+               MDC.put(Enum.ClassName.name(), getCaller(3));
+       }
+               
+       public static void quartzJobEnd(JobExecutionContext context) 
+       {
+               MDC.put(MDC_END_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
+               MDC.put(Enum.ClassName.name(), getCaller(3));
+       }
+
+       public static Map<String, String> save() 
+       {
+               Map<String, String> save = MDC.getCopyOfContextMap();
+               return save;
+       }
+
+       public static void restore(Map<String, String> mdcSave) 
+       {
+               MDC.clear();
+               for (String name : mdcSave.keySet())
+                       MDC.put(name, mdcSave.get(name));
+       }
+
+
+
+       public static void setRequestIdIfNotSet(String requestId) {
+               if (MDC.get(MDC_KEY_REQUEST_ID) == null || MDC.get(MDC_KEY_REQUEST_ID).equals(""))
+       {
+                       setRequestId(requestId);
+               }
+       }
+       
+       public static void setRequestId(String requestId) {
+               MDC.put(MDC_KEY_REQUEST_ID, requestId);
+       }
+               
+       public static void metricStart(ClientRequestContext requestContext) {
+               MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
+               MDC.put(MDC_END_TIMESTAMP, MDC.get(MDC_BEGIN_TIMESTAMP));
+               setPartnerTargetFromUri(requestContext.getUri());
+       }
+
+       public static void metricEnd(ClientResponseContext response) 
+       {
+               
+               Date now = new Date();
+               //MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(now));
+               MDC.put(MDC_END_TIMESTAMP, Stopwatch.isoFormatter.format(now));
+               setResponseInfo(response.getStatusInfo());
+               
+       }
+       public static void auditStart(ContainerRequestContext requestContext, HttpServletRequest servletRequest) 
+       {
+               MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
+               MDC.put(MDC_END_TIMESTAMP, MDC.get(MDC_BEGIN_TIMESTAMP));
+               MDC.put(MDC_REMOTE_HOST, servletRequest.getRemoteHost());
+               MDC.put(Enum.ClassName.name(), getCaller(4));
+               MultivaluedMap<String, String> headers = requestContext.getHeaders();
+               String transactionId = (String) headers.getFirst(HeadersEnum.TransactionID.toString());
+               if (transactionId != null)
+               {
+                       setRequestId(transactionId);
+               }
+               else
+               {
+                       setRequestId(UUID.randomUUID().toString());
+               }
+               
+       }
+
+       public static void auditEnd(ContainerRequestContext requestContext, ContainerResponseContext response)
+       {
+               Date now = new Date();
+               //MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(now));
+               MDC.put(MDC_END_TIMESTAMP, Stopwatch.isoFormatter.format(now));
+               MDC.put(Enum.ClassName.name(), getCaller(4));
+               
+               setResponseInfo(response.getStatusInfo());
+               
+       }
+                
+       private static void setResponseInfo(StatusType statusInfo)
+       {
+               Integer status = statusInfo.getStatusCode();
+               String completed = "ERROR";
+               if (status >=200 && status < 300)
+               {
+                       completed = "COMPLETE";
+               }
+               MDC.put(MDC_RESPONSE_CODE, status.toString());
+               MDC.put(MDC_RESPONSE_DESC, statusInfo.getReasonPhrase());
+               MDC.put(MDC_STATUS_CODE, completed);
+       }
+               
+       public static void setEvent(String requestID) {
+               MDC.put(MDC_BEGIN_TIMESTAMP, Stopwatch.isoFormatter.format(new Date()));
+               MDC.put(MDC_END_TIMESTAMP, MDC.get(MDC_BEGIN_TIMESTAMP));
+               setRequestId(requestID);
+       }
+
+       private static void setPartnerTargetFromUri(URI uri)
+       {
+               try
+               {
+                       MDC.put(MDC_PARTNER_NAME, uri.getHost());
+                       MDC.put(MDC_TARGET_ENTITY, uri.getScheme() + "://" + uri.getHost() + ":" + uri.getPort());
+                       MDC.put(MDC_TARGET_SERVICE_NAME, uri.getPath());
+               }
+               catch (Exception e)
+               {
+                       MDC.put(MDC_PARTNER_NAME, "UNKNOWN");
+                       MDC.put(MDC_TARGET_ENTITY, "UNKNOWN");
+                       MDC.put(MDC_TARGET_SERVICE_NAME, "UNKNOWN");
+               }
+       }
+
+
+}
\ No newline at end of file
diff --git a/cmso-service/src/main/java/org/onap/observations/Observation.java b/cmso-service/src/main/java/org/onap/observations/Observation.java
new file mode 100644 (file)
index 0000000..39bc3ca
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright © 2019 AT&T Intellectual Property.
+ * 
+ * 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.
+ * 
+ * 
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *         https://creativecommons.org/licenses/by/4.0/
+ * 
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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.
+*/
+package org.onap.observations;
+
+import org.apache.log4j.Level;
+import org.onap.optf.cmso.Application;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+
+public class Observation 
+{
+       private static EELFLogger log = EELFManager.getInstance().getLogger(Application.class);
+       private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();
+       private static EELFLogger audit = EELFManager.getInstance().getAuditLogger();
+       private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
+       private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
+       
+       //*************************************************************************************************
+       public static void report(ObservationInterface o, Exception e, String ...arguments) 
+       {
+               Mdc.setCaller(4);
+               Mdc.setObservation(o);
+               if (o.getAudit())
+               {
+                       audit.info(o, e, arguments);
+               }
+               if (o.getMetric())
+               {
+                       metrics.info(o, e, arguments);
+               }
+               Level l = o.getLevel();
+               switch (l.toInt())
+               {
+               case Level.WARN_INT:
+                       errors.warn(o, arguments);
+                       debug.debug(o, e, arguments);
+                       break;
+               case Level.INFO_INT:
+                       log.info(o, e, arguments);
+                       debug.debug(o, e, arguments);
+                       break;
+               case Level.ERROR_INT:
+                       errors.error(o, arguments);
+                       debug.debug(o, e, arguments);
+                       break;
+               case Level.TRACE_INT:
+                       debug.trace(o, e, arguments);
+                       break;
+               case Level.DEBUG_INT:
+                       debug.debug(o, e, arguments);
+                       break;
+               default:
+                       log.info(o, e, arguments);
+               }
+               Mdc.clearCaller();
+       }
+       
+       public static void report(ObservationInterface o, String ...arguments) 
+       {
+               Mdc.setCaller(4);
+               Mdc.setObservation(o);
+               if (o.getAudit())
+               {
+                       audit.info(o, arguments);
+               }
+               if (o.getMetric())
+               {
+                       metrics.info(o, arguments);
+               }
+               Level l = o.getLevel();
+               switch (l.toInt())
+               {
+               case Level.WARN_INT:
+                       errors.warn(o, arguments);
+                       debug.debug(o, arguments);
+                       break;
+               case Level.INFO_INT:
+                       log.info(o, arguments);
+                       debug.debug(o, arguments);
+                       break;
+               case Level.ERROR_INT:
+                       errors.error(o, arguments);
+                       debug.debug(o, arguments);
+                       break;
+               case Level.TRACE_INT:
+                       debug.debug(o, arguments);
+                       break;
+               case Level.DEBUG_INT:
+                       debug.debug(o, arguments);
+                       break;
+               default:
+                       log.info(o, arguments);
+               }
+               Mdc.clearCaller();
+       }
+
+}
diff --git a/cmso-service/src/main/java/org/onap/observations/ObservationInterface.java b/cmso-service/src/main/java/org/onap/observations/ObservationInterface.java
new file mode 100644 (file)
index 0000000..16305bc
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright © 2019 AT&T Intellectual Property.
+ * 
+ * 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.
+ * 
+ * 
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *         https://creativecommons.org/licenses/by/4.0/
+ * 
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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.
+*/
+package org.onap.observations;
+
+import javax.ws.rs.core.Response.Status;
+
+import org.apache.log4j.Level;
+
+import com.att.eelf.i18n.EELFResolvableErrorEnum;
+
+public interface ObservationInterface extends EELFResolvableErrorEnum
+{
+       public Enum<?> getValue();
+       public Level getLevel();
+       public String getMessage();
+       public Status getStatus();
+       public String getDomain();
+       public String name();
+       public Boolean getAudit();
+       public Boolean getMetric();
+}
\ No newline at end of file
diff --git a/cmso-service/src/main/java/org/onap/observations/ObservationObject.java b/cmso-service/src/main/java/org/onap/observations/ObservationObject.java
new file mode 100644 (file)
index 0000000..639db76
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright © 2019 AT&T Intellectual Property.
+ * 
+ * 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.
+ * 
+ * 
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *         https://creativecommons.org/licenses/by/4.0/
+ * 
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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.
+*/
+package org.onap.observations;
+
+import javax.ws.rs.core.Response.Status;
+
+import org.apache.log4j.Level;
+
+import com.att.eelf.i18n.EELFResolvableErrorEnum;
+import com.att.eelf.i18n.EELFResourceManager;
+
+
+public class ObservationObject implements ObservationInterface
+{
+       
+       //*************************************************************************************************
+       // Interface class that matches the ObservationInteface  pattern
+       // This will be used in case we decide to provide external overrides and we need to instantiate
+       // For now, we'll just use the Enum itself.
+       //
+       // 
+       private Enum<?> value = null;
+       private Level level = null;;
+       private String message = null;
+       private Status status = null;
+       private String domain = null;
+       private Boolean metric = false;
+       private Boolean audit = false;
+       public ObservationObject(ObservationInterface o)
+       {
+               this.value = o.getValue();
+               this.level = o.getLevel();
+               this.message = o.getMessage();
+               this.status = o.getStatus();
+               this.domain = o.getDomain();
+               this.metric = o.getMetric();
+               this.audit = o.getAudit();
+               
+       }
+       public Enum<?> getValue() {return value;}
+       @Override
+       public String getMessage() {return message;}
+       @Override
+       public Status getStatus() {return status;}
+       @Override
+       public String getDomain() {return domain;}
+
+       @Override
+       public Level getLevel() {
+               return level;
+       }
+       @Override
+       public String name() {
+               return value.name();
+       }
+       @Override
+       public Boolean getAudit() {
+               return audit;
+       }
+       @Override
+       public Boolean getMetric() {
+               return metric;
+       }
+
+       public String getMessage(String ...arguments) {
+               return EELFResourceManager.format((EELFResolvableErrorEnum)value,  arguments);
+       }
+       public void setValue(Enum<?> value) {
+               this.value = value;
+       }
+       public void setLevel(Level level) {
+               this.level = level;
+       }
+       public void setMessage(String message) {
+               this.message = message;
+       }
+       public void setStatus(Status status) {
+               this.status = status;
+       }
+
+
+}
index 0f497b7..3d98897 100644 (file)
@@ -31,6 +31,7 @@
 package org.onap.optf.cmso;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Profile;
 import org.springframework.core.env.Environment;
 import org.springframework.security.authentication.AuthenticationProvider;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -40,6 +41,8 @@ import org.springframework.stereotype.Component;
 import java.util.ArrayList;
 
 @Component
+@Profile(SpringProfiles.PROPRIETARY__AUTHENTICATION)
+
 public class AuthProvider
   implements AuthenticationProvider {
  
index a4802d2..ef12a6d 100644 (file)
@@ -33,6 +33,7 @@ package org.onap.optf.cmso;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
 import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
 import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -41,6 +42,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
 @Configuration
 @EnableWebSecurity
 @ComponentScan("org.onap.optf")
+@Profile(SpringProfiles.PROPRIETARY__AUTHENTICATION)
 public class SecurityConfig extends WebSecurityConfigurerAdapter {
   
     @Autowired
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/SpringProfiles.java b/cmso-service/src/main/java/org/onap/optf/cmso/SpringProfiles.java
new file mode 100644 (file)
index 0000000..a2fdc69
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.optf.cmso
+ * ================================================================================
+ * Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.optf.cmso;
+
+public class SpringProfiles 
+{
+
+    public static final String AAF_AUTHENTICATION  = "aaf-auth";
+    public static final String PROPRIETARY__AUTHENTICATION  = "proprietary-auth";
+
+    private SpringProfiles(){}
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafAuthorizationFilter.java b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafAuthorizationFilter.java
new file mode 100644 (file)
index 0000000..25a1e77
--- /dev/null
@@ -0,0 +1,91 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.optf.cmso
+ * ================================================================================
+ * Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.optf.cmso.aaf;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.aaf.cadi.CadiWrap;
+import org.onap.aaf.cadi.Permission;
+import org.onap.observations.Observation;
+import org.onap.optf.cmso.SpringProfiles;
+import org.onap.optf.cmso.common.LogMessages;
+import org.onap.optf.cmso.common.exceptions.CMSException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Component;
+
+/**
+ * AAF authorization filter
+ */
+
+@Component
+@Profile(SpringProfiles.AAF_AUTHENTICATION)
+public class AafAuthorizationFilter extends  OrderedRequestContextFilter {
+
+       @Autowired
+       AafUserRoleProperties userRoleProperties;
+       
+    public AafAuthorizationFilter() {
+        this.setOrder(FilterPriority.AAF_AUTHORIZATION.getPriority());
+
+       
+    }
+
+    @Override
+    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
+       try
+       {
+               if (request instanceof CadiWrap)
+               {
+                       CadiWrap cw = (CadiWrap)request;
+                       List<Permission> perms = cw.getPermissions(cw.getUserPrincipal());
+                       if (userRoleProperties.processPermissions(request, perms))
+                       {
+                               filterChain.doFilter(request,response);
+                       }
+                       else
+                       {
+                       Observation.report(LogMessages.UNAUTHORIZED);
+                               ResponseFormatter.errorResponse(request, response, 
+                               new CMSException(LogMessages.UNAUTHORIZED.getStatus(), 
+                               LogMessages.UNAUTHORIZED, ""));
+                       }
+               }
+               else
+               {
+                       throw new Exception();
+               }
+       }
+       catch (Exception e)
+       {
+               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+               ResponseFormatter.errorResponse(request, response, 
+                       new CMSException(LogMessages.UNAUTHORIZED.getStatus(), 
+                       LogMessages.UNAUTHORIZED, ""));
+       }
+    }
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafFilter.java b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafFilter.java
new file mode 100644 (file)
index 0000000..1bdebdd
--- /dev/null
@@ -0,0 +1,71 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.optf.cmso
+ * ================================================================================
+ * Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.optf.cmso.aaf;
+
+
+import java.io.IOException;
+import java.util.Properties;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.filter.CadiFilter;
+import org.onap.observations.Observation;
+import org.onap.optf.cmso.Application;
+import org.onap.optf.cmso.SpringProfiles;
+import org.onap.optf.cmso.common.LogMessages;
+import org.onap.optf.cmso.common.exceptions.CMSException;
+import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Component;
+
+/**
+ * AAF authentication filter
+ */
+
+@Component
+@Profile(SpringProfiles.AAF_AUTHENTICATION)
+public class AafFilter extends OrderedRequestContextFilter {
+
+    private final CadiFilter cadiFilter;
+
+    public AafFilter() throws IOException, ServletException {
+        Properties cadiProperties = new Properties();
+        cadiProperties.load(Application.class.getClassLoader().getResourceAsStream("cadi.properties"));
+        cadiFilter = new CadiFilter(new PropAccess(cadiProperties));
+        this.setOrder(FilterPriority.AAF_AUTHENTICATION.getPriority());
+    }
+
+    @Override
+    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
+        cadiFilter.doFilter(request, response, filterChain);
+        if(response.getStatus() ==401){
+               Observation.report(LogMessages.UNAUTHENTICATED);
+            ResponseFormatter.errorResponse(request, response, 
+                       new CMSException(LogMessages.UNAUTHENTICATED.getStatus(), 
+                       LogMessages.UNAUTHENTICATED, ""));
+        }
+    }
+
+
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafPerm.java b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafPerm.java
new file mode 100644 (file)
index 0000000..ea9d324
--- /dev/null
@@ -0,0 +1,78 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.optf.cmso
+ * ================================================================================
+ * Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.optf.cmso.aaf;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.onap.aaf.cadi.aaf.AAFPermission;
+
+
+public class AafPerm 
+{
+       private String type;
+       private String instance;
+       private String action;
+       private Set<String> actions = new HashSet<>();
+       
+       public String getAction() {
+               return action;
+       }
+       public void setAction(String action) {
+               this.action = action;
+               String list[] = action.split(",");
+               for (String a : list)
+                       actions.add(a);
+       }
+       public String getType() {
+               return type;
+       }
+       public void setType(String type) {
+               this.type = type;
+       }
+       public String getInstance() {
+               return instance;
+       }
+       public void setInstance(String instance) {
+               this.instance = instance;
+       }
+       
+       public Set<String> getActions() {
+               return actions;
+       }
+       public void setActions(Set<String> actions) {
+               this.actions = actions;
+       }
+       public boolean matches(AAFPermission userPerm)
+       {
+               if (type.equals(userPerm.getType()))
+               {
+                       if (userPerm.getInstance().equals("*") || instance.equals("*") || userPerm.getInstance().equals(instance))
+                       {
+                               for (String userAction : userPerm.getAction().split(","))
+                               {
+                                       if (userAction.equals("*") || actions.contains("*") || actions.contains(userAction))
+                                               return true;
+                               }
+                       }
+               }
+               return false;
+       }
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafSecurityConfig.java b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafSecurityConfig.java
new file mode 100644 (file)
index 0000000..cb00a90
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright © 2019 AT&T Intellectual Property.
+ * 
+ * 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.
+ * 
+ * 
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *         https://creativecommons.org/licenses/by/4.0/
+ * 
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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.
+*/
+package org.onap.optf.cmso.aaf;
+
+import org.onap.optf.cmso.SpringProfiles;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+
+@Configuration
+@EnableWebSecurity
+@ComponentScan("org.onap.optf")
+@Profile(SpringProfiles.AAF_AUTHENTICATION)
+public class AafSecurityConfig extends WebSecurityConfigurerAdapter {
+  
+    @Override
+    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+  
+    }
+    @Override
+    protected void configure(HttpSecurity http) throws Exception {
+       
+        http.csrf().disable();
+        
+    }
+}
\ No newline at end of file
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafUserRole.java b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafUserRole.java
new file mode 100644 (file)
index 0000000..762cf3c
--- /dev/null
@@ -0,0 +1,127 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.optf.cmso
+ * ================================================================================
+ * Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.optf.cmso.aaf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class AafUserRole 
+{
+       private String url = "";
+       private String pathParts[] = {};
+       private String perm  = "";
+       private String method = "";
+       private List<AafPerm>  aafPerms = new ArrayList<>(); 
+       
+       public AafUserRole(String url, String perm)
+       {
+               this.setUrl(url);
+               this.setPerm(perm);
+               pathParts = url.split("\\/");
+               
+               String[] perms = perm.split(",");
+               for (String p : perms)
+               {
+                       String parts[] = p.split(" ");
+                       if (parts.length == 2)
+                               method = parts[1];
+                       else
+                               method = "ALL";
+                       
+                       String[] list = parts[0].split("\\|");
+                       if (list.length == 3)
+                       {
+                               AafPerm aafPerm = new AafPerm();
+                               aafPerm.setAction(list[2]);
+                               aafPerm.setInstance(list[1]);
+                               aafPerm.setType(list[0]);
+                               aafPerms.add(aafPerm);
+                       }
+               }
+       }
+       public String getUrl() {
+               return url;
+       }
+       public void setUrl(String url) {
+               this.url = url;
+       }
+       public String getPerm() {
+               return perm;
+       }
+       public void setPerm(String perm) {
+               this.perm = perm;
+       }
+       public List<AafPerm> getAafPerms() {
+               return aafPerms;
+       }
+       public void setAafPerms(List<AafPerm> aafPerms) {
+               this.aafPerms = aafPerms;
+       }
+
+       public boolean matches(String path, String matchMethod)
+       {
+               if (!this.method.equalsIgnoreCase("ALL") 
+                       && !this.method.equals("*")
+                       && !this.method.equals(matchMethod))
+                       return false;
+               List<String> inNodes = new ArrayList<>();
+               List<String> matchNodes = new ArrayList<>();
+               String[] pathList = path.split("\\/");
+               for (String n : pathList)
+               {
+                       inNodes.add(n);
+               }
+               for (String n : pathParts)
+               {
+                       matchNodes.add(n);
+               }
+               
+               while (!inNodes.isEmpty() && !matchNodes.isEmpty())
+               {
+                       String inNode = inNodes.remove(0);
+                       String matchNode = matchNodes.get(0);
+                       if (matchNode.equals(inNode) || matchNode.equals("*"))
+                       {
+                               matchNodes.remove(0);
+                       }
+                       else
+                       {       
+                               if (!matchNode.equals("**"))
+                               {
+                                       return false;
+                               }
+                       }
+               }
+               
+               // 
+               if (inNodes.isEmpty() && matchNodes.isEmpty())
+                       return true;
+               
+               // We have incoming nodes remaining, see if we can wildcard them
+               if (matchNodes.size() == 1)
+               {
+                       if (matchNodes.get(0).equals("**"))
+                               return true;
+                       if (inNodes.size() == 1 && matchNodes.get(0).equals("*"))
+                               return true;
+               }
+               return false;
+       }
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafUserRoleProperties.java b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafUserRoleProperties.java
new file mode 100644 (file)
index 0000000..7a7598d
--- /dev/null
@@ -0,0 +1,128 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.optf.cmso
+ * ================================================================================
+ * Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.optf.cmso.aaf;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import javax.annotation.PostConstruct;
+import javax.servlet.http.HttpServletRequest;
+
+import org.onap.aaf.cadi.Permission;
+import org.onap.aaf.cadi.aaf.AAFPermission;
+import org.onap.observations.Observation;
+import org.onap.optf.cmso.SpringProfiles;
+import org.onap.optf.cmso.common.LogMessages;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Profile;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+/**
+ * 
+ * This class uses a properties file to map URL patterns/method to AAF Permissions (AafPerm)
+ * @author jf9860
+ *
+ */
+@Component
+@Profile(SpringProfiles.AAF_AUTHENTICATION)
+public class AafUserRoleProperties 
+{
+       @Autowired
+       Environment env;
+       
+       private List<AafUserRole> list = new ArrayList<>();
+       
+       @PostConstruct
+       public void initializePermissions()
+       {
+               String userRolePropertiesName = env.getProperty("aaf.user.roles", "src/main/resources/aaf/AAFUserRoles.properties");
+               Properties props = new Properties();
+               try
+               {
+                       props.load(new FileInputStream(new File(userRolePropertiesName)));
+               }
+               catch (Exception e)
+               {
+                       Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+               }
+               for (Object url : props.keySet())
+               {
+                       Object value = props.get(url);
+                       list.add(new AafUserRole((String)url, (String)value));
+               }
+       }
+
+       public List<AafUserRole> getForUrlMethod(String url, String method)
+       {
+               List<AafUserRole> userRoleList = new ArrayList<>();
+               for (AafUserRole aur : list)
+               {
+                       if (aur.matches(url, method))
+                       {
+                               userRoleList.add(aur);
+                       }
+               }
+               return userRoleList;
+       }
+
+       public boolean processPermissions(HttpServletRequest request, List<Permission> userPerms) 
+       {
+               try
+               {
+                       // Get list of perms that match incoming URL. May be more than 1...
+                       // Users perms must match all that match URL
+                       List<AafUserRole> perms = getForUrlMethod(request.getRequestURI(), request.getMethod());
+                       ObjectMapper om = new ObjectMapper();
+                       int tested = 0;
+                       int passed = 0;
+                       for (AafUserRole perm : perms)
+                       {
+                               for (AafPerm test : perm.getAafPerms())
+                               {
+                                       tested++;
+                                       for (Permission userPerm: userPerms)
+                                       {
+                                               
+                                               if (test.matches((AAFPermission)userPerm))
+                                               {
+                                                       passed++;
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+                       // All permissions must be OK
+                       if (tested > 0 && tested == passed)
+                               return true;
+                       else
+                               return false;
+               }
+               catch (Exception e) 
+               {
+                       Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+               }
+               return false;
+       }
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/FilterPriority.java b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/FilterPriority.java
new file mode 100644 (file)
index 0000000..39981c7
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.optf.cmso
+ * ================================================================================
+ * Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.optf.cmso.aaf;
+
+import org.springframework.core.Ordered;
+
+public enum FilterPriority {
+    AAF_AUTHENTICATION(Ordered.HIGHEST_PRECEDENCE),
+    AAF_AUTHORIZATION(Ordered.HIGHEST_PRECEDENCE + 1); //higher number = lower priority
+
+    private final int priority;
+
+    FilterPriority(final int p) {
+        priority = p;
+    }
+
+    public int getPriority() { return priority; }
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/ResponseFormatter.java b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/ResponseFormatter.java
new file mode 100644 (file)
index 0000000..769262b
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.optf.cmso
+ * ================================================================================
+ * Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.optf.cmso.aaf;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.core.MediaType;
+
+import org.onap.optf.cmso.common.exceptions.CMSException;
+
+class ResponseFormatter {
+
+    private static final String ACCEPT_HEADER = "accept";
+
+    static void errorResponse(HttpServletRequest request, HttpServletResponse response, CMSException error) throws IOException {
+        String accept = request.getHeader(ACCEPT_HEADER) == null ? MediaType.APPLICATION_JSON : request.getHeader(ACCEPT_HEADER);
+        response.setStatus(error.getStatus().getStatusCode());
+        response.getWriter().write(error.getRequestError().toString());
+        response.getWriter().flush();
+        response.getWriter().close();
+    }
+
+}
index 6026bc4..efb4dd0 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright © 2017-2019 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -34,118 +34,204 @@ package org.onap.optf.cmso.common;
 import java.io.IOException;\r
 import java.nio.file.Files;\r
 import java.nio.file.Paths;\r
+\r
+import javax.ws.rs.core.Response.Status;\r
+\r
+import org.apache.log4j.Level;\r
+import org.onap.observations.ObservationInterface;\r
+\r
 import com.att.eelf.configuration.EELFManager;\r
-import com.att.eelf.i18n.EELFResolvableErrorEnum;\r
 import com.att.eelf.i18n.EELFResourceManager;\r
 \r
-public enum LogMessages implements EELFResolvableErrorEnum {\r
-\r
-    // Let developer provide the initial properties here.\r
-    // We can merge them to logmessages.properties when we need to.\r
-    SEARCH_SCHEDULE_REQUEST_DETAILS("Search Schedule Request Details {0} from {1}: {2}"), SEARCH_SCHEDULE_REQUEST(\r
-            "Search Schedule Request {0} from {1}: {2} : {3}"), CREATE_SCHEDULE_REQUEST(\r
-                    "Create Schedule Request {0} from {1}: {2} : {3}"), DELETE_SCHEDULE_REQUEST(\r
-                            "Delete Schedule Request {0} from {1}: {2} : {3}"), GET_SCHEDULE_REQUEST_INFO(\r
-                                    "Get Schedule Request Info {0} from {1}: {2} : {3}"), PROCESS_OPTIMIZER_CALLBACK(\r
-                                            "Change management optimizer callback {0} from {1}: {2} "), APPROVE_SCHEDULE_REQUEST(\r
-                                                    "Approve Schedule Request {0} from {1}: {2} : {3}"), SCHEDULE_ALREADY_EXISTS(\r
-                                                            "Schedule already exists domain={0} schedule id={1}"), SCHEDULE_NOT_FOUND(\r
-                                                                    "Schedule not found domain={0} schedule id={1}"), INVALID_ATTRIBUTE(\r
-                                                                            "Invalid attribute {0}={1}"), MISSING_REQUIRED_ATTRIBUTE(\r
-                                                                                    "Missing required attribute '{0}'"), INVALID_REQUEST(\r
-                                                                                            "The input data structure is incorrect"), REQUEST_TIMED_OUT(\r
-                                                                                                    "Request timed out."), UNEXPECTED_EXCEPTION(\r
-                                                                                                            "Unexpected exception encountered during processing. Please contact support : {0}"), AUTHORIZATION_FAILED(\r
-                                                                                                                    "Authorization Failed"), UNDEFINED_DOMAIN_DATA_ATTRIBUTE(\r
-                                                                                                                            "Domain data attribute not defined domain={0} name={1} value={2}"), UNDEFINED_FILTER_ATTRIBUTE(\r
-                                                                                                                                    "Undefined filter attribute {0}"), INVALID_DATE_FILTER(\r
-                                                                                                                                            "Invalid date filter provided {0}=(1}"), OPTIMIZER_QUARTZ_JOB(\r
-                                                                                                                                                    "Quartz scheduling of OptimizerQuartzJob: {0}"), OPTIMIZER_EXCEPTION(\r
-                                                                                                                                                            "Exception making client call to optimizer {0}"), OPTIMIZER_CALLBACK_STATE_ERROR(\r
-                                                                                                                                                                    "Optimizer callback on schedule in invalid state. Should be {0} but was {1}."), CHANGE_MANAGEMENT_GROUP_NOT_FOUND(\r
-                                                                                                                                                                            "ChangeManagementGroup not found on optimizer callback scheduleId={0} groupId={1}"), UNABLE_TO_ALLOCATE_VNF_TIMESLOTS(\r
-                                                                                                                                                                                    "Unable to allocate VNF timeslots with Optimizer results startTime={0}, latestStartTime={1}, totalDuration={2}, concurrency={3} nvfs={4}"), UNABLE_TO_LOCATE_SCHEDULE_DETAIL(\r
-                                                                                                                                                                                            "Unable to locate ChangeManagementSchedule for VNF. scheduleId={0}, groupId={1}, vnfName={2}"), CM_JOB(\r
-                                                                                                                                                                                                    "Quartz scheduling of CmJob: {0}"), CM_QUARTZ_JOB(\r
-                                                                                                                                                                                                            "Quartz scheduling of CmQuartzJob: {0}"), NOT_PENDING_APPROVAL(\r
-                                                                                                                                                                                                                    "Approval request received for schedule that is not in Pending Approval state: domain={0} scheduleId={1} state={3}"), SCHEDULE_PAST_DUE(\r
-                                                                                                                                                                                                                            "Attempt to dispatch an event that is Past due scheduleId={0}, vnf={1}, now={2}, startTime={3}"), MSO_POLLING_MISSING_SCHEDULE(\r
-                                                                                                                                                                                                                                    "Attempt to poll MSO for request id {1} for missing ChangeManagementSchedule id={0}"), MSO_STATUS_JOB(\r
-                                                                                                                                                                                                                                            "Polling MSO {0} for requestId={1} for id={2}"), UNEXPECTED_RESPONSE(\r
-                                                                                                                                                                                                                                                    "Unexpected response from {0} HTTP Status={1} : {2}"), SCHEDULE_STATUS_JOB(\r
-                                                                                                                                                                                                                                                            "Quartz scheduling of ScheduleStatusJob: {0}"), CM_TICKET_NOT_APPROVED(\r
-                                                                                                                                                                                                                                                                    "Attempt to dispatch a change management event that has no TM Ticket approved. scheduleId={0} VNF Name={1} TM ChangeId={2} Status={3} Approval Status={4}"), MULTIPLE_GROUPS_NOT_SUPPORTED(\r
-                                                                                                                                                                                                                                                                            "Multiple groups not supported on immediate requests"), TM_CREATE_CHANGE_RECORD(\r
-                                                                                                                                                                                                                                                                                    "TM Create Change Record:{0} : Schedule ID: {1}"), TM_LIST(\r
-                                                                                                                                                                                                                                                                                            "TM list:{0} : URL : {1}"), TM_API(\r
-                                                                                                                                                                                                                                                                                                    "TM API Call: URL : {0}"), UNABLE_TO_CREATE_CHANGE_TICKET(\r
-                                                                                                                                                                                                                                                                                                            "Unable to create change ticket in TM: Schedule ID: {0} : Reason : {1}"), TM_UPDATE_CHECKLIST(\r
-                                                                                                                                                                                                                                                                                                                    "TM Fetch Checklist:{0} : Schedule ID: {1} : Change Id : {2} : URL : {3}"), OPTIMIZER_REQUEST(\r
-                                                                                                                                                                                                                                                                                                                            "Optimi Request:{0} : Schedule ID: {1} : URL : {2}"), TM_CLOSE_CHANGE_RECORD(\r
-                                                                                                                                                                                                                                                                                                                                    "TM Close Change Record:{0} : Schedule ID: {1} : Change Id : {2}"), UNABLE_TO_CLOSE_CHANGE_TICKET(\r
-                                                                                                                                                                                                                                                                                                                                            "Unable to close change ticket in TM:  Schedule ID: {0} : changeid: {1} :  Reason: {2}"), CANNOT_CANCEL_IN_PROGRESS(\r
-                                                                                                                                                                                                                                                                                                                                                    "Cannot delete/cancel a schedule with events in progress."), UNABLE_TO_PARSE_SCHEDULING_INFO(\r
-                                                                                                                                                                                                                                                                                                                                                            "Cannot parse scheduling info."), UNABLE_TO_LOCATE_CHANGE_RECORD(\r
-                                                                                                                                                                                                                                                                                                                                                                    "Unable to locate TM change record {2} to check status before displacth of {1} for schedulId={0}"), INVALID_CHANGE_WINDOW(\r
-                                                                                                                                                                                                                                                                                                                                                                            "Change window end time {1} must be after start time {0}"), NODE_LIST_CONTAINS_EMTPY_NODE(\r
-                                                                                                                                                                                                                                                                                                                                                                                    "vnfDetails node list contains at least one empty node."), SO_API(\r
-                                                                                                                                                                                                                                                                                                                                                                                            "SO Poll Request {0}"), EXPECTED_EXCEPTION(\r
-                                                                                                                                                                                                                                                                                                                                                                                                    "Expected exception encountered during processing. Make Sonar happy: {0}"), TM_UPDATE_CHANGE_RECORD(\r
-                                                                                                                                                                                                                                                                                                                                                                                                            "TM Update Change Record:{0} : Schedule ID: {1} : Change Id : {2} : URL : {3}"), UNABLE_TO_UPDATE_CHANGE_TICKET(\r
-                                                                                                                                                                                                                                                                                                                                                                                                                    "Unable to update change ticket in TM: Schedule ID: {0} : changeid: {1} :  Reason: {2}"),;\r
+public enum LogMessages implements ObservationInterface {\r
 \r
-    private final String defaultId;\r
-    private final String defaultMessage;\r
-    private final String defaultResolution;\r
-    private final String defaultAction;\r
+       SEARCH_SCHEDULE_REQUEST_DETAILS("Search Schedule Request Details {0} from {1}: {2}", Status.OK, Level.INFO),\r
+       SEARCH_SCHEDULE_REQUEST("Search Schedule Request {0} from {1}: {2} : {3}", Status.OK, Level.INFO),\r
+       CREATE_SCHEDULE_REQUEST("Create Schedule Request {0} from {1}: {2} : {3}", Status.OK, Level.INFO),\r
+       DELETE_SCHEDULE_REQUEST("Delete Schedule Request {0} from {1}: {2} : {3}", Status.OK, Level.INFO),\r
+       GET_SCHEDULE_REQUEST_INFO("Get Schedule Request Info {0} from {1}: {2} : {3}", Status.OK, Level.INFO),\r
+       PROCESS_OPTIMIZER_CALLBACK("Change management optimizer callback {0} from {1}: {2} ", Status.OK, Level.INFO),\r
+       APPROVE_SCHEDULE_REQUEST("Approve Schedule Request {0} from {1}: {2} : {3}", Status.OK, Level.INFO),\r
+       SCHEDULE_ALREADY_EXISTS("Schedule already exists domain={0} schedule id={1}", Status.OK, Level.INFO),\r
+       SCHEDULE_NOT_FOUND("Schedule not found domain={0} schedule id={1}", Status.BAD_REQUEST, Level.INFO),\r
+       INVALID_ATTRIBUTE("Invalid attribute {0}={1}", Status.BAD_REQUEST, Level.INFO),\r
+       MISSING_REQUIRED_ATTRIBUTE("Missing required attribute '{0}'", Status.BAD_REQUEST, Level.INFO),\r
+       INVALID_REQUEST("The input data structure is incorrect", Status.BAD_REQUEST, Level.INFO),\r
+       REQUEST_TIMED_OUT("Request timed out.", Status.INTERNAL_SERVER_ERROR, Level.ERROR),\r
+       UNEXPECTED_EXCEPTION("Unexpected exception encountered during processing. Please contact support : {0}", Status.INTERNAL_SERVER_ERROR, Level.ERROR),\r
+       UNDEFINED_DOMAIN_DATA_ATTRIBUTE("Domain data attribute not defined domain={0} name={1} value={2}", Status.BAD_REQUEST, Level.INFO),\r
+       UNDEFINED_FILTER_ATTRIBUTE("Undefined filter attribute {0}", Status.BAD_REQUEST, Level.INFO),\r
+       INVALID_DATE_FILTER("Invalid date filter provided {0}=(1}", Status.BAD_REQUEST, Level.INFO),\r
+       OPTIMIZER_QUARTZ_JOB("Quartz scheduling of OptimizerQuartzJob: {0}", Status.OK, Level.INFO),\r
+       OPTIMIZER_EXCEPTION("Exception making client call to optimizer {0}", Status.INTERNAL_SERVER_ERROR, Level.ERROR),\r
+       OPTIMIZER_CALLBACK_STATE_ERROR("Optimizer callback on schedule in invalid state. Should be {0} but was {1}.", Status.INTERNAL_SERVER_ERROR, Level.ERROR),\r
+       CHANGE_MANAGEMENT_GROUP_NOT_FOUND("ChangeManagementGroup not found on optimizer callback scheduleId={0} groupId={1}", Status.NOT_FOUND, Level.INFO),\r
+       INCOMING_MESSAGE("Incoming message method={0} path={1}", Status.OK, Level.INFO, true, false),\r
+       INCOMING_MESSAGE_RESPONSE("Message response method={0} path={1} status={2}", Status.OK, Level.INFO, true, false),\r
+       OUTGOING_MESSAGE("Outgoing message method={0} path={1}", Status.OK, Level.INFO, true, false),\r
+       OUTGOING_MESSAGE_RETURNED("Outgoing message returned method={0} path={1} status={2}", Status.OK, Level.INFO, true, false),\r
 \r
-    private LogMessages(String message) {\r
-        defaultMessage = message;\r
-        this.defaultId = this.name();\r
-        this.defaultResolution = "No resolution needed";\r
-        this.defaultAction = "No action is required";\r
-    }\r
+    // TODO: Review the status and level of the remaining enums        \r
+       UNABLE_TO_ALLOCATE_VNF_TIMESLOTS("Unable to allocate VNF timeslots with Optimizer results startTime={0}, latestStartTime={1}, totalDuration={2}, concurrency={3} nvfs={4}", Status.OK, Level.INFO),\r
+       UNABLE_TO_LOCATE_SCHEDULE_DETAIL("Unable to locate ChangeManagementSchedule for VNF. scheduleId={0}, groupId={1}, vnfName={2}", Status.OK, Level.INFO),\r
+       CM_JOB("Quartz scheduling of CmJob: {0}", Status.OK, Level.INFO),\r
+       CM_QUARTZ_JOB("Quartz scheduling of CmQuartzJob: {0}", Status.OK, Level.INFO),\r
+       NOT_PENDING_APPROVAL("Approval request received for schedule that is not in Pending Approval state: domain={0} scheduleId={1} state={3}", Status.OK, Level.INFO),\r
+       SCHEDULE_PAST_DUE("Attempt to dispatch an event that is Past due scheduleId={0}, vnf={1}, now={2}, startTime={3}", Status.OK, Level.INFO),\r
+       MSO_POLLING_MISSING_SCHEDULE("Attempt to poll MSO for request id {1} for missing ChangeManagementSchedule id={0}", Status.OK, Level.INFO),\r
+       MSO_STATUS_JOB("Polling MSO {0} for requestId={1} for id={2}", Status.OK, Level.INFO),\r
+       UNEXPECTED_RESPONSE("Unexpected response from {0} HTTP Status={1} : {2}", Status.OK, Level.INFO),\r
+       SCHEDULE_STATUS_JOB("Quartz scheduling of ScheduleStatusJob: {0}", Status.OK, Level.INFO),\r
+       CM_TICKET_NOT_APPROVED("Attempt to dispatch a change management event that has no TM Ticket approved. scheduleId={0} VNF Name={1} TM ChangeId={2} Status={3} Approval Status={4}", Status.OK, Level.INFO),\r
+       MULTIPLE_GROUPS_NOT_SUPPORTED("Multiple groups not supported on immediate requests", Status.OK, Level.INFO),\r
+       TM_CREATE_CHANGE_RECORD("TM Create Change Record:{0} : Schedule ID: {1}", Status.OK, Level.INFO),\r
+       TM_LIST("TM list:{0} : URL : {1}", Status.OK, Level.INFO),\r
+       TM_API("TM API Call: URL : {0}", Status.OK, Level.INFO),\r
+       UNABLE_TO_CREATE_CHANGE_TICKET("Unable to create change ticket in TM: Schedule ID: {0} : Reason : {1}", Status.OK, Level.INFO),\r
+       TM_UPDATE_CHECKLIST("TM Fetch Checklist:{0} : Schedule ID: {1} : Change Id : {2} : URL : {3}", Status.OK, Level.INFO),\r
+       OPTIMIZER_REQUEST("Optimi Request:{0} : Schedule ID: {1} : URL : {2}", Status.OK, Level.INFO),\r
+       TM_CLOSE_CHANGE_RECORD("TM Close Change Record:{0} : Schedule ID: {1} : Change Id : {2}", Status.OK, Level.INFO),\r
+       UNABLE_TO_CLOSE_CHANGE_TICKET("Unable to close change ticket in TM:  Schedule ID: {0} : changeid: {1} :  Reason: {2}", Status.OK, Level.INFO),\r
+       CANNOT_CANCEL_IN_PROGRESS("Cannot delete/cancel a schedule with events in progress.", Status.OK, Level.INFO),\r
+       UNABLE_TO_PARSE_SCHEDULING_INFO("Cannot parse scheduling info.", Status.OK, Level.INFO),\r
+       UNABLE_TO_LOCATE_CHANGE_RECORD("Unable to locate TM change record {2} to check status before displacth of {1} for schedulId={0}", Status.OK, Level.INFO),\r
+       INVALID_CHANGE_WINDOW("Change window end time {1} must be after start time {0}", Status.OK, Level.INFO),\r
+       NODE_LIST_CONTAINS_EMTPY_NODE("vnfDetails node list contains at least one empty node.", Status.OK, Level.INFO),\r
+       SO_API("SO Poll Request {0}", Status.OK, Level.INFO),\r
+       EXPECTED_EXCEPTION("Expected exception encountered during processing. {0}", Status.OK, Level.INFO),\r
+       TM_UPDATE_CHANGE_RECORD("TM Update Change Record:{0} : Schedule ID: {1} : Change Id : {2} : URL : {3}", Status.OK, Level.INFO),\r
+       UNABLE_TO_UPDATE_CHANGE_TICKET("Unable to update change ticket in TM: Schedule ID: {0} : changeid: {1} :  Reason: {2}", Status.OK, Level.INFO),\r
+       UNAUTHORIZED("Authorization failed.", Status.FORBIDDEN, Level.INFO),\r
+       UNAUTHENTICATED("Authentication failed.", Status.UNAUTHORIZED, Level.INFO), \r
+       UNRECOGNIZED_MSO_STATUS("Unrecognized status returned by MSO {0}", Status.INTERNAL_SERVER_ERROR, Level.ERROR),\r
+       UNABLE_TO_PARSE_MSO_RESPONSE("Unable to parse status message from MSO {0} : {1}", Status.INTERNAL_SERVER_ERROR, Level.ERROR),\r
+       ;\r
+       private final String defaultId;\r
+       private final String defaultMessage;\r
+       private final String defaultResolution;\r
+       private final String defaultAction;\r
 \r
-    private LogMessages(String message, String id, String resolution, String action) {\r
-        defaultMessage = message;\r
-        this.defaultId = id;\r
-        this.defaultResolution = resolution;\r
-        this.defaultAction = action;\r
-    }\r
+       private final Status status;\r
+       private final Level level;\r
+       private final Boolean audit;\r
+       private final Boolean metric;\r
 \r
-    static {\r
-        EELFResourceManager.loadMessageBundle("logmessages");\r
-    }\r
+       \r
+       private LogMessages(String message, Status code, Level l)\r
+       {\r
+               defaultMessage = message;\r
+               level=l;\r
+               status = code;\r
+               this.defaultId = this.name();\r
+               this.defaultResolution = "No resolution needed";\r
+               this.defaultAction = "No action is required";\r
+               this.audit = false;\r
+               this.metric = false;\r
+       }\r
 \r
-    public String genProperties() {\r
-        // Use this to regenerate properties file. The desire to change messages without\r
-        // updating code is\r
-        // well understood, but the developer should be able to code the defaults\r
-        // without having to update 2 different files and\r
-        // get it wrong.\r
-        StringBuilder sb = new StringBuilder();\r
-        sb.append("# Generated from ").append(this.getClass().getName()).append("\n");\r
-        for (LogMessages lm : values()) {\r
-            sb.append(lm.name());\r
-            sb.append(" ").append(lm.defaultId);\r
-            sb.append("|").append(lm.defaultMessage);\r
-            sb.append("|").append(lm.defaultResolution);\r
-            sb.append("|").append(lm.defaultAction);\r
-            sb.append("\n");\r
-        }\r
-        return sb.toString();\r
-    }\r
+       private LogMessages(String message, Status code, Level l, Boolean audit, Boolean metric)\r
+       {\r
+               defaultMessage = message;\r
+               level=l;\r
+               status = code;\r
+               this.audit = audit;\r
+               this.metric = metric;\r
+               this.defaultId = this.name();\r
+               this.defaultResolution = "No resolution needed";\r
+               this.defaultAction = "No action is required";\r
+       }\r
+       \r
+       private LogMessages(String message, Status code, Level l, String id, String resolution, String action)\r
+       {\r
+               level=l;\r
+               status = code;\r
+               defaultMessage = message;\r
+               this.defaultId = id;\r
+               this.defaultResolution = resolution;\r
+               this.defaultAction = action;\r
+               this.audit = false;\r
+               this.metric = false;\r
+       }\r
+       \r
+       static {\r
+               EELFResourceManager.loadMessageBundle("logmessages");\r
+       }\r
+       \r
+       public String genProperties()\r
+       {\r
+               // Use this to regenerate properties file. The desire to change messages without updating code is\r
+               // well understood, but the developer should be able to code the defaults without having to update 2 different files and \r
+               // get it wrong. \r
+               StringBuilder sb = new StringBuilder();\r
+               sb.append("# Generated from ").append(this.getClass().getName()).append("\n");\r
+               for (LogMessages lm : values())\r
+               {\r
+                       sb.append(lm.name());\r
+                       sb.append(" ").append(lm.defaultId);\r
+                       sb.append("|").append(lm.defaultMessage);\r
+                       sb.append("|").append(lm.defaultResolution);\r
+                       sb.append("|").append(lm.defaultAction);\r
+                       sb.append("\n");\r
+               }\r
+               return sb.toString();\r
+       }\r
 \r
-    public static void main(String argv[]) {\r
-        System.out.println(LogMessages.CREATE_SCHEDULE_REQUEST.genProperties());\r
-        try {\r
-            Files.write(Paths.get("src/main/resources/logmessages.properties"),\r
-                    LogMessages.CREATE_SCHEDULE_REQUEST.genProperties().getBytes());\r
-        } catch (IOException e) {\r
-            EELFManager.getInstance().getDebugLogger().debug("Failed to update properties file.", e);\r
+       \r
+       // interface methods\r
+       @Override\r
+       public Level getLevel() {return level;}\r
+       @Override\r
+       public String getMessage() {return defaultMessage;}\r
+       @Override\r
+       public Status getStatus() {return status;}\r
+       @Override\r
+       public Enum<?> getValue() {return this;}\r
+       @Override\r
+       public String getDomain() {return this.getClass().getSimpleName();}\r
+       @Override\r
+       public Boolean getAudit() { return audit; }\r
+       @Override\r
+       public Boolean getMetric() { return metric; }\r
+       \r
+       public static void main(String argv[])\r
+       {\r
+               System.out.println(LogMessages.UNEXPECTED_EXCEPTION.genProperties());\r
+               try \r
+               {\r
+                       Files.write(Paths.get("src/main/resources/logmessages.properties"), LogMessages.UNEXPECTED_EXCEPTION.genProperties().getBytes());\r
+               } \r
+               catch (IOException e) \r
+               {\r
+                       EELFManager.getInstance().getDebugLogger().debug("Failed to update properties file.", e);\r
 \r
-        }\r
+               }\r
+               StringBuilder sb = new StringBuilder();\r
+               sb.append("<html><body><h1>Cell Site Selection Scheduler mS Observations</h1>\n<table border=\"1\">\n<tr>");\r
+               sb.append("<td>Code</td> ");\r
+               sb.append("<td>Log Level</td> ");\r
+               sb.append("<td>Message</td> ");\r
+               sb.append("</tr>\n");\r
+               for (LogMessages m : LogMessages.values())\r
+               {\r
+                       if (m.level == Level.ERROR || m.level == Level.WARN || m.level == Level.FATAL)\r
+                       {\r
+                               sb.append("<tr>");\r
+                               sb.append("<td>").append(m.name()).append("</td> ");\r
+                               sb.append("<td>").append(m.level).append("</td> ");\r
+                               sb.append("<td>").append(m.defaultMessage).append("</td> ");\r
+                               sb.append("</tr>\n");\r
+                       }\r
+               }\r
+               try \r
+               {\r
+                       Files.write(Paths.get("logmessages.html"), sb.toString().getBytes());\r
+               } \r
+               catch (IOException e) \r
+               {\r
+                       EELFManager.getInstance().getDebugLogger().debug("Failed to update properties html file.", e);\r
 \r
-    }\r
+               }\r
+                               \r
+       }\r
 \r
 }\r
index de78385..880566a 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright © 2017-2019 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
 package org.onap.optf.cmso.dispatcher;\r
 \r
 import java.util.Map;\r
+\r
 import javax.ws.rs.client.Client;\r
 import javax.ws.rs.client.ClientBuilder;\r
 import javax.ws.rs.client.Invocation;\r
 import javax.ws.rs.client.WebTarget;\r
 import javax.ws.rs.core.MediaType;\r
 import javax.ws.rs.core.Response;\r
+\r
+import org.onap.observations.Mdc;\r
 import org.onap.optf.cmso.common.BasicAuthenticatorFilter;\r
 import org.onap.optf.cmso.common.LogMessages;\r
-import org.onap.optf.cmso.common.Mdc;\r
 import org.onap.optf.cmso.common.PropertiesManagement;\r
 import org.onap.optf.cmso.eventq.DispatchedEventList;\r
+import org.onap.optf.cmso.filters.CMSOClientFilters;\r
 import org.onap.optf.cmso.model.dao.ChangeManagementGroupDAO;\r
 import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;\r
 import org.onap.optf.cmso.model.dao.ScheduleDAO;\r
@@ -55,6 +58,7 @@ import org.quartz.SchedulerException;
 import org.springframework.beans.factory.annotation.Autowired;\r
 import org.springframework.core.env.Environment;\r
 import org.springframework.stereotype.Component;\r
+\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
 \r
@@ -121,13 +125,12 @@ public class CmJob implements Job {
             String pass = pm.getProperty("mechid.pass", "");\r
             Client client = ClientBuilder.newClient();\r
             client.register(new BasicAuthenticatorFilter(user, pass));\r
+                       client.register(new CMSOClientFilters());\r
             WebTarget target = client.target(url);\r
             Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON);\r
             Response response = null;\r
             try {\r
-                Mdc.metricStart(id.toString(), url);\r
                 response = invocationBuilder.get();\r
-                Mdc.metricEnd(response);\r
                 metrics.info(LogMessages.CM_JOB, id.toString());\r
                 switch (response.getStatus()) {\r
                     case 200:\r
index 1e8a937..3aab301 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright © 2017-2019 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
 \r
 package org.onap.optf.cmso.dispatcher.rs;\r
 \r
-import java.util.UUID;\r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.ws.rs.core.Response;\r
 import javax.ws.rs.core.UriInfo;\r
+\r
 import org.onap.optf.cmso.common.LogMessages;\r
-import org.onap.optf.cmso.common.Mdc;\r
 import org.onap.optf.cmso.dispatcher.DispatchJob;\r
 import org.onap.optf.cmso.optimizer.CMSOptimizerClient;\r
 import org.onap.optf.cmso.sostatus.MsoStatusClient;\r
@@ -44,6 +43,7 @@ import org.onap.optf.cmso.ticketmgt.TmStatusClient;
 import org.springframework.beans.factory.annotation.Autowired;\r
 import org.springframework.stereotype.Controller;\r
 import org.springframework.transaction.annotation.Transactional;\r
+\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
 \r
@@ -69,8 +69,7 @@ public class DispatcherServiceImpl implements DispacherService {
     @Override\r
     @Transactional\r
     public Response dispatchSchedule(Integer id, UriInfo uri, HttpServletRequest request) {\r
-        Mdc.begin(request, UUID.randomUUID().toString());\r
-        log.info("dispatchVID entered {}", id);\r
+        debug.debug("dispatchSchedule entered  {}" , id);\r
         try {\r
             dispatchJob.execute(id);\r
         } catch (Exception e) {\r
@@ -78,16 +77,13 @@ public class DispatcherServiceImpl implements DispacherService {
             debug.error(e.getMessage(), e);\r
         }\r
         Response response = Response.ok().build();\r
-        Mdc.end(response);\r
-        audit.info("dispatchVID");\r
         return response;\r
     }\r
 \r
     @Override\r
     @Transactional\r
     public Response dispatchOptimizer(Integer id, UriInfo uri, HttpServletRequest request) {\r
-        Mdc.begin(request, UUID.randomUUID().toString());\r
-        log.info("Dispatch.exec entered {}", id);\r
+        debug.debug("dispatchOptimizer entered {}", id);\r
         try {\r
             sniroClient.scheduleSniroOptimization(id);\r
         } catch (Exception e) {\r
@@ -95,7 +91,6 @@ public class DispatcherServiceImpl implements DispacherService {
             debug.error(e.getMessage(), e);\r
         }\r
         Response response = Response.ok().build();\r
-        Mdc.end(response);\r
         audit.info("dispatchSNIRO");\r
         return response;\r
     }\r
@@ -103,8 +98,7 @@ public class DispatcherServiceImpl implements DispacherService {
     @Override\r
     @Transactional\r
     public Response dispatchScheduleStatus(Integer id, UriInfo uri, HttpServletRequest request) {\r
-        Mdc.begin(request, UUID.randomUUID().toString());\r
-        log.info("Dispatch.exec entered {}", id);\r
+        debug.debug("dispatchScheduleStatus entered {}", id);\r
         try {\r
             tmStatusClient.checkStatus(id);\r
         } catch (Exception e) {\r
@@ -112,16 +106,13 @@ public class DispatcherServiceImpl implements DispacherService {
             debug.error(e.getMessage(), e);\r
         }\r
         Response response = Response.ok().build();\r
-        Mdc.end(response);\r
-        audit.info("dispatchScheduleStatus");\r
         return response;\r
     }\r
 \r
     @Override\r
     @Transactional\r
     public Response dispatchSoStatus(Integer id, UriInfo uri, HttpServletRequest request) {\r
-        Mdc.begin(request, UUID.randomUUID().toString());\r
-        log.info("Dispatch.exec entered {}", id);\r
+        debug.debug("dispatchSoStatus entered {}", id);\r
         try {\r
             msoStatusClient.execute(id);\r
         } catch (Exception e) {\r
@@ -129,8 +120,6 @@ public class DispatcherServiceImpl implements DispacherService {
             debug.error(e.getMessage(), e);\r
         }\r
         Response response = Response.ok().build();\r
-        Mdc.end(response);\r
-        audit.info("dispatchMsoStatus");\r
         return response;\r
     }\r
 \r
index 08017cf..f3d98b3 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -31,8 +31,8 @@
 \r
 package org.onap.optf.cmso.eventq;\r
 \r
+import org.onap.observations.Mdc;\r
 import org.onap.optf.cmso.common.LogMessages;\r
-import org.onap.optf.cmso.common.Mdc;\r
 import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;\r
 import org.quartz.DisallowConcurrentExecution;\r
 import org.quartz.JobExecutionContext;\r
index 6396dca..5e29607 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright © 2017-2019 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
 package org.onap.optf.cmso.filters;\r
 \r
 import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;\r
+\r
 import java.io.IOException;\r
+\r
 import javax.ws.rs.client.ClientRequestContext;\r
 import javax.ws.rs.client.ClientRequestFilter;\r
 import javax.ws.rs.client.ClientResponseContext;\r
 import javax.ws.rs.client.ClientResponseFilter;\r
 import javax.ws.rs.core.MultivaluedMap;\r
+\r
+import org.onap.observations.Mdc;\r
+import org.onap.observations.Observation;\r
+import org.onap.optf.cmso.common.LogMessages;\r
 import org.onap.optf.cmso.filters.MessageHeaders.HeadersEnum;\r
 import org.onap.optf.cmso.service.rs.CMSOServiceImpl;\r
 import org.slf4j.MDC;\r
 import org.springframework.stereotype.Component;\r
+\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
 \r
@@ -54,14 +61,23 @@ public class CMSOClientFilters implements ClientRequestFilter, ClientResponseFil
 \r
     @Override\r
     public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {\r
-        // On the way back\r
-        log.info("SchedulerClientFilters.filter(r,r)");\r
+               // On the way back\r
+               Mdc.metricEnd(responseContext);\r
+               Mdc.setCaller(17);\r
+               Observation.report(LogMessages.OUTGOING_MESSAGE_RETURNED, \r
+                               requestContext.getMethod(),\r
+                               requestContext.getUri().getPath().toString(),\r
+                               responseContext.getStatusInfo().toString());\r
     }\r
 \r
     @Override\r
     public void filter(ClientRequestContext requestContext) throws IOException {\r
-        // On the way out\r
-        log.info("SchedulerClientFilters.filter(r)" + requestContext.getUri().getPath());\r
+               // On the way out \r
+               Mdc.metricStart(requestContext);\r
+               Mdc.setCaller(17);\r
+               Observation.report(LogMessages.OUTGOING_MESSAGE, \r
+                               requestContext.getMethod(),\r
+                               requestContext.getUri().getPath().toString());\r
         MultivaluedMap<String, Object> headers = requestContext.getHeaders();\r
 \r
         String transactionId = (String) headers.getFirst(MessageHeaders.HeadersEnum.TransactionID.toString());\r
index 784ab5a..8b37a71 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright © 2017-2019 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -33,34 +33,44 @@ package org.onap.optf.cmso.filters;
 \r
 import java.io.IOException;\r
 import java.util.UUID;\r
+\r
 import javax.annotation.Priority;\r
+import javax.servlet.http.HttpServletRequest;\r
 import javax.ws.rs.WebApplicationException;\r
 import javax.ws.rs.container.ContainerRequestContext;\r
 import javax.ws.rs.container.ContainerRequestFilter;\r
 import javax.ws.rs.container.ContainerResponseContext;\r
 import javax.ws.rs.container.ContainerResponseFilter;\r
+import javax.ws.rs.core.Context;\r
 import javax.ws.rs.core.MultivaluedMap;\r
 import javax.ws.rs.core.Response;\r
 import javax.ws.rs.core.Response.ResponseBuilder;\r
 import javax.ws.rs.ext.Provider;\r
+\r
+import org.onap.observations.Mdc;\r
+import org.onap.observations.Observation;\r
 import org.onap.optf.cmso.common.LogMessages;\r
 import org.onap.optf.cmso.filters.MessageHeaders.HeadersEnum;\r
-import org.onap.optf.cmso.service.rs.CMSOServiceImpl;\r
 import org.springframework.stereotype.Component;\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
 \r
 @Priority(1)\r
 @Provider\r
 @Component\r
 public class CMSOContainerFilters implements ContainerRequestFilter, ContainerResponseFilter {\r
-    private static EELFLogger log = EELFManager.getInstance().getLogger(CMSOServiceImpl.class);\r
+\r
+\r
+       @Context\r
+       private HttpServletRequest servletRequest;\r
 \r
     @Override\r
     public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)\r
             throws IOException {\r
         try {\r
-            log.info("SchedulerContainerFilters.filter(r,r)");\r
+                       Mdc.auditEnd(requestContext, responseContext);\r
+                       Observation.report(LogMessages.INCOMING_MESSAGE_RESPONSE, \r
+                                       requestContext.getMethod(),\r
+                                       requestContext.getUriInfo().getPath().toString(),\r
+                                       responseContext.getStatusInfo().toString());\r
             MultivaluedMap<String, String> reqHeaders = requestContext.getHeaders();\r
             MultivaluedMap<String, Object> respHeaders = responseContext.getHeaders();\r
             String minorVersion = (String) reqHeaders.getFirst(HeadersEnum.MinorVersion.toString());\r
@@ -70,9 +80,9 @@ public class CMSOContainerFilters implements ContainerRequestFilter, ContainerRe
 \r
         } catch (Exception e) {\r
             if (e instanceof WebApplicationException) {\r
-                log.info(LogMessages.EXPECTED_EXCEPTION, e.getMessage());\r
+               Observation.report(LogMessages.EXPECTED_EXCEPTION, e.getMessage());\r
             } else {\r
-                log.info(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());\r
+               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());\r
             }\r
         }\r
     }\r
@@ -81,7 +91,10 @@ public class CMSOContainerFilters implements ContainerRequestFilter, ContainerRe
     public void filter(ContainerRequestContext requestContext) throws IOException {\r
         try {\r
             // On the way in\r
-            log.info("SchedulerContainerFilters.filter(r) path={} ", requestContext.getUriInfo().getPath().toString());\r
+                       Mdc.auditStart(requestContext, servletRequest);\r
+                       Observation.report(LogMessages.INCOMING_MESSAGE, \r
+                                       requestContext.getMethod(),\r
+                                       requestContext.getUriInfo().getPath().toString());\r
 \r
             String majorVersion = requestContext.getUriInfo().getPath();\r
             if (majorVersion != null) {\r
@@ -116,10 +129,10 @@ public class CMSOContainerFilters implements ContainerRequestFilter, ContainerRe
             }\r
         } catch (Exception e) {\r
             if (e instanceof WebApplicationException) {\r
-                log.info(LogMessages.EXPECTED_EXCEPTION, e.getMessage());\r
+                Observation.report(LogMessages.EXPECTED_EXCEPTION, e.getMessage());\r
                 throw e;\r
             } else {\r
-                log.info(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());\r
+               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());\r
             }\r
         }\r
 \r
index 153e4a8..5d500d2 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright © 2017-2019 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -35,6 +35,7 @@ import java.util.ArrayList;
 import java.util.List;\r
 import java.util.Map;\r
 import java.util.UUID;\r
+\r
 import javax.ws.rs.ProcessingException;\r
 import javax.ws.rs.client.Client;\r
 import javax.ws.rs.client.ClientBuilder;\r
@@ -44,10 +45,12 @@ import javax.ws.rs.client.ResponseProcessingException;
 import javax.ws.rs.client.WebTarget;\r
 import javax.ws.rs.core.MediaType;\r
 import javax.ws.rs.core.Response;\r
+\r
+import org.onap.observations.Mdc;\r
+import org.onap.observations.Observation;\r
 import org.onap.optf.cmso.common.BasicAuthenticatorFilter;\r
 import org.onap.optf.cmso.common.CMSStatusEnum;\r
 import org.onap.optf.cmso.common.LogMessages;\r
-import org.onap.optf.cmso.common.Mdc;\r
 import org.onap.optf.cmso.common.PropertiesManagement;\r
 import org.onap.optf.cmso.filters.CMSOClientFilters;\r
 import org.onap.optf.cmso.model.Schedule;\r
@@ -64,15 +67,13 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;\r
 import org.springframework.stereotype.Component;\r
 import org.springframework.transaction.annotation.Transactional;\r
+\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
 import com.fasterxml.jackson.databind.ObjectMapper;\r
 \r
 @Component\r
 public class CMSOptimizerClient {\r
-    private static EELFLogger log = EELFManager.getInstance().getLogger(CMSOptimizerClient.class);\r
-    private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();\r
-    private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();\r
     private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();\r
 \r
     @Autowired\r
@@ -117,7 +118,7 @@ public class CMSOptimizerClient {
                 }\r
                 buildRequest(cmReq, info, schedule, snirocallbackurl);\r
             } catch (Exception e) {\r
-                errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+                Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
                 schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString());\r
                 schedule.setOptimizerMessage("Unexpected exception: " + e.getMessage());\r
                 updateScheduleStatus(schedule);\r
@@ -146,13 +147,9 @@ public class CMSOptimizerClient {
                 updateScheduleStatus(schedule);\r
                 debug.debug("SNIRO url / user: " + snirourl + " / " + username);\r
                 debug.debug("SNIRO Request: " + new ObjectMapper().writeValueAsString(cmReq));\r
-                log.info(LogMessages.OPTIMIZER_REQUEST, "Begin", schedule.getScheduleId(), snirourl);\r
-                Mdc.metricStart(schedule.getScheduleId(), snirourl);\r
+                Observation.report(LogMessages.OPTIMIZER_REQUEST, "Begin", schedule.getScheduleId(), snirourl);\r
                 Response response = invocationBuilder.post(Entity.json(cmReq));\r
-\r
-                Mdc.metricEnd(response);\r
-                metrics.info(LogMessages.OPTIMIZER_REQUEST, "End", schedule.getScheduleId(), snirourl);\r
-                log.info(LogMessages.OPTIMIZER_REQUEST, "End", schedule.getScheduleId(), snirourl);\r
+                Observation.report(LogMessages.OPTIMIZER_REQUEST, "End", schedule.getScheduleId(), snirourl);\r
                 switch (response.getStatus()) {\r
                     case 202:\r
                         debug.debug("Successfully scheduled optimization: " + schedule.getScheduleId());\r
@@ -171,7 +168,7 @@ public class CMSOptimizerClient {
                         tries++;\r
                         schedule.setOptimizerAttemptsToSchedule(tries);\r
                         updateScheduleStatus(schedule);\r
-                        errors.error(LogMessages.OPTIMIZER_EXCEPTION, message);\r
+                        Observation.report(LogMessages.OPTIMIZER_EXCEPTION, message);\r
                         return true;\r
                     }\r
 \r
@@ -188,7 +185,7 @@ public class CMSOptimizerClient {
                         updateScheduleStatus(schedule);\r
                         /// Got processing error response\r
                         // may be transient, wait for next cycle.\r
-                        errors.error(LogMessages.OPTIMIZER_EXCEPTION, message);\r
+                        Observation.report(LogMessages.OPTIMIZER_EXCEPTION, message);\r
                         // Wait until next cycle and try again.\r
                         return false;\r
                     }\r
@@ -207,7 +204,7 @@ public class CMSOptimizerClient {
                 updateScheduleStatus(schedule);\r
                 // Getting invalid response from SNIRO.\r
                 // May be data related.\r
-                errors.error(LogMessages.OPTIMIZER_EXCEPTION, e, e.getMessage());\r
+                Observation.report(LogMessages.OPTIMIZER_EXCEPTION, e, e.getMessage());\r
                 return false;\r
 \r
             } catch (ProcessingException e) {\r
@@ -216,12 +213,12 @@ public class CMSOptimizerClient {
                 schedule.setStatus(CMSStatusEnum.PendingSchedule.toString());\r
                 updateScheduleStatus(schedule);\r
                 /// Cannot connect to SNIRO\r
-                errors.error(LogMessages.OPTIMIZER_EXCEPTION, e, e.getMessage());\r
+                Observation.report(LogMessages.OPTIMIZER_EXCEPTION, e, e.getMessage());\r
                 // Wait until next cycle\r
                 return false;\r
             }\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
 \r
         } finally {\r
             Mdc.restore(mdcSave);\r
@@ -285,7 +282,7 @@ public class CMSOptimizerClient {
             // We may have an issue when upgrading....\r
             // Perhaps We create ChangeManagementSchedulingInfoV1, ...V2, etc.\r
             // ANd try them one after another....\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, "Unable to parse message. Format changed?");\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, "Unable to parse message. Format changed?");\r
             schedule.setOptimizerStatus("Failed to parse SNIRO request");\r
             schedule.setOptimizerDateTimeMillis(System.currentTimeMillis());\r
             schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString());\r
@@ -336,15 +333,14 @@ public class CMSOptimizerClient {
 \r
             Client client = ClientBuilder.newClient();\r
             client.register(new BasicAuthenticatorFilter(username, password));\r
+            client.register(new CMSOClientFilters());\r
+\r
             WebTarget sniroTarget = client.target(snirourl);\r
             Invocation.Builder invocationBuilder = sniroTarget.request(MediaType.APPLICATION_JSON);\r
             debug.debug("SNIRO url / user: " + snirourl + " / " + username);\r
-            log.info(LogMessages.OPTIMIZER_REQUEST, "Begin", "healthcheck", snirourl);\r
-            Mdc.metricStart("healthcjeck", snirourl);\r
+            Observation.report(LogMessages.OPTIMIZER_REQUEST, "Begin", "healthcheck", snirourl);\r
             Response response = invocationBuilder.post(Entity.json(cmReq));\r
-            Mdc.metricEnd(response);\r
-            metrics.info(LogMessages.OPTIMIZER_REQUEST, "End", "healthcheck", snirourl);\r
-            log.info(LogMessages.OPTIMIZER_REQUEST, "End", "healthcheck", snirourl);\r
+            Observation.report(LogMessages.OPTIMIZER_REQUEST, "End", "healthcheck", snirourl);\r
             String message = response.getStatus() + ":" + response.readEntity(String.class);\r
             switch (response.getStatus()) {\r
                 case 202:\r
@@ -366,7 +362,7 @@ public class CMSOptimizerClient {
                     break;\r
             }\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e.toString());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e.toString());\r
             hcc.setStatus(e.toString());\r
         } finally {\r
             Mdc.restore(mdcSave);\r
index 064566c..39d590b 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright © 2017-2019 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -39,12 +39,14 @@ import javax.ws.rs.client.Invocation;
 import javax.ws.rs.client.WebTarget;\r
 import javax.ws.rs.core.MediaType;\r
 import javax.ws.rs.core.Response;\r
+\r
+import org.onap.observations.Mdc;\r
 import org.onap.optf.cmso.common.BasicAuthenticatorFilter;\r
 import org.onap.optf.cmso.common.CMSStatusEnum;\r
 import org.onap.optf.cmso.common.DomainsEnum;\r
 import org.onap.optf.cmso.common.LogMessages;\r
-import org.onap.optf.cmso.common.Mdc;\r
 import org.onap.optf.cmso.common.PropertiesManagement;\r
+import org.onap.optf.cmso.filters.CMSOClientFilters;\r
 import org.onap.optf.cmso.model.Schedule;\r
 import org.onap.optf.cmso.model.dao.ScheduleDAO;\r
 import org.quartz.DisallowConcurrentExecution;\r
@@ -115,13 +117,11 @@ public class OptimizerQuartzJob extends QuartzJobBean {
             String pass = pm.getProperty("mechid.pass", "");\r
             Client client = ClientBuilder.newClient();\r
             client.register(new BasicAuthenticatorFilter(user, pass));\r
+            client.register(new CMSOClientFilters());\r
             WebTarget target = client.target(url);\r
             Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON);\r
             Response response = null;\r
-            Mdc.metricStart(id.toString(), url);\r
             response = invocationBuilder.get();\r
-            Mdc.metricEnd(response);\r
-            metrics.info(LogMessages.OPTIMIZER_QUARTZ_JOB, id.toString());\r
             switch (response.getStatus()) {\r
                 case 200:\r
                     log.info("Returned from dispatch call");\r
index 9f1a4d5..b878d31 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright © 2017-2019 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -35,7 +35,8 @@ import java.util.UUID;
 import javax.servlet.http.HttpServletRequest;\r
 import javax.ws.rs.core.Response;\r
 import javax.ws.rs.core.UriInfo;\r
-import org.onap.optf.cmso.common.Mdc;\r
+\r
+import org.onap.observations.Mdc;\r
 import org.onap.optf.cmso.common.PropertiesManagement;\r
 import org.springframework.beans.factory.annotation.Autowired;\r
 import org.springframework.stereotype.Controller;\r
@@ -52,14 +53,11 @@ public class AdminToolImpl implements AdminTool {
 \r
     @Override\r
     public Response exec(String apiVersion, String id, UriInfo uri, HttpServletRequest request) {\r
-        Mdc.begin(request, UUID.randomUUID().toString());\r
         log.info("AdminTool.exec entered");\r
         if (id.length() < 4)\r
             return Response.ok("").build();\r
         String encrypted = pm.getEncryptedValue(id);\r
         Response response = Response.ok(encrypted).build();\r
-        Mdc.end(response);\r
-        audit.info("AdminTool");\r
         return response;\r
     }\r
 \r
index 9fb8a96..5d11225 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright © 2017-2019 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -42,10 +42,10 @@ import javax.ws.rs.core.UriInfo;
 import org.joda.time.DateTime;\r
 import org.joda.time.format.DateTimeFormat;\r
 import org.joda.time.format.ISODateTimeFormat;\r
+import org.onap.observations.Mdc;\r
 import org.onap.optf.cmso.common.CMSStatusEnum;\r
 import org.onap.optf.cmso.common.DomainsEnum;\r
 import org.onap.optf.cmso.common.LogMessages;\r
-import org.onap.optf.cmso.common.Mdc;\r
 import org.onap.optf.cmso.common.exceptions.CMSException;\r
 import org.onap.optf.cmso.common.exceptions.CMSNotFoundException;\r
 import org.onap.optf.cmso.model.ChangeManagementGroup;\r
@@ -88,7 +88,6 @@ public class CMSCallbackImpl extends BaseSchedulerServiceImpl implements CMSOpti
     public Response sniroCallback(String apiVersion, CMOptimizerResponse sniroResponse, UriInfo uri,\r
             HttpServletRequest request) {\r
         Response response = null;\r
-        Mdc.begin(request, sniroResponse.getTransactionId());\r
         log.info(LogMessages.PROCESS_OPTIMIZER_CALLBACK, "Received", request.getRemoteAddr(), "");\r
         log.info(LogMessages.OPTIMIZER_REQUEST, "Callback received", sniroResponse.getTransactionId(),\r
                 uri.getAbsolutePath().toString());\r
@@ -138,13 +137,6 @@ public class CMSCallbackImpl extends BaseSchedulerServiceImpl implements CMSOpti
             response = Response.serverError().entity(e.getMessage()).build();\r
         } finally {\r
         }\r
-        Mdc.end(response);\r
-        log.info(LogMessages.OPTIMIZER_REQUEST, "Callback completed", sniroResponse.getTransactionId(),\r
-                uri.getAbsolutePath().toString());\r
-        audit.info(LogMessages.PROCESS_OPTIMIZER_CALLBACK, "Returned", request.getRemoteAddr(),\r
-                response.getStatusInfo().toString());\r
-        metrics.info(LogMessages.PROCESS_OPTIMIZER_CALLBACK, "Returned", request.getRemoteAddr(),\r
-                response.getStatusInfo().toString());\r
         return response;\r
     }\r
 \r
index 26d0fe5..c3d61da 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright © 2017-2019 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -39,19 +39,20 @@ import java.util.List;
 import java.util.Map;\r
 import java.util.Set;\r
 import java.util.TimeZone;\r
-import java.util.UUID;\r
+\r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.ws.rs.core.MultivaluedMap;\r
 import javax.ws.rs.core.Response;\r
 import javax.ws.rs.core.Response.Status;\r
 import javax.ws.rs.core.UriInfo;\r
+\r
 import org.joda.time.DateTime;\r
+import org.onap.observations.Observation;\r
 import org.onap.optf.cmso.common.ApprovalStatusEnum;\r
 import org.onap.optf.cmso.common.ApprovalTypesEnum;\r
 import org.onap.optf.cmso.common.CMSStatusEnum;\r
 import org.onap.optf.cmso.common.DomainsEnum;\r
 import org.onap.optf.cmso.common.LogMessages;\r
-import org.onap.optf.cmso.common.Mdc;\r
 import org.onap.optf.cmso.common.exceptions.CMSException;\r
 import org.onap.optf.cmso.common.exceptions.CMSNotFoundException;\r
 import org.onap.optf.cmso.eventq.CMSQueueJob;\r
@@ -83,15 +84,12 @@ import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Controller;\r
 import org.springframework.transaction.annotation.Transactional;\r
 import org.springframework.transaction.interceptor.TransactionAspectSupport;\r
+\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
 \r
 @Controller\r
 public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOService {\r
-    private static EELFLogger log = EELFManager.getInstance().getLogger(CMSOServiceImpl.class);\r
-    private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();\r
-    private static EELFLogger audit = EELFManager.getInstance().getAuditLogger();\r
-    private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();\r
     private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();\r
 \r
     @Autowired\r
@@ -129,15 +127,14 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
             String scheduleName, String userId, String status, String createDateTime, String optimizerStatus,\r
             String workflowName, UriInfo uri, HttpServletRequest request) {\r
 \r
-        Mdc.begin(request, UUID.randomUUID().toString());\r
-        log.info(LogMessages.SEARCH_SCHEDULE_REQUEST, "Received", request.getRemoteAddr(), uri.toString(), "");\r
+        Observation.report(LogMessages.SEARCH_SCHEDULE_REQUEST, "Received", request.getRemoteAddr(), uri.toString(), "");\r
         Response response = null;\r
         List<Schedule> schedules = new ArrayList<Schedule>();\r
         try {\r
-            log.info("Timezone=" + TimeZone.getDefault());\r
-            MultivaluedMap<String, String> qp = uri.getQueryParameters();\r
+            debug.debug("Timezone={}", TimeZone.getDefault());\r
             StringBuilder where = new StringBuilder();\r
             int maxRows = 0;\r
+            //MultivaluedMap<String, String> qp = uri.getQueryParameters();\r
             // buildWhere(qp, where);\r
             List<ScheduleQuery> list = scheduleQueryDAO.searchSchedules(where.toString(), maxRows);\r
             if (list == null || !list.iterator().hasNext()) {\r
@@ -162,21 +159,14 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
             }\r
             response = Response.ok(schedules.toArray(new Schedule[schedules.size()])).build();\r
         } catch (CMSException e) {\r
-            debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
-            log.info(e.getMessage());\r
+               Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());\r
             response = Response.status(e.getStatus()).entity(e.getRequestError()).build();\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
-            debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
             response = Response.serverError().build();\r
         }\r
 \r
-        Mdc.end(response);\r
-        log.info(LogMessages.SEARCH_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), schedules.toString(),\r
-                response.getStatusInfo().toString());\r
-        audit.info(LogMessages.SEARCH_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), schedules.toString(),\r
-                response.getStatusInfo().toString());\r
-        metrics.info(LogMessages.SEARCH_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), schedules.toString(),\r
+        Observation.report(LogMessages.SEARCH_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), schedules.toString(),\r
                 response.getStatusInfo().toString());\r
         return response;\r
     }\r
@@ -185,8 +175,7 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
     @Transactional\r
     public Response createScheduleRequest(String apiVersion, String scheduleId, CMSMessage scheduleMessage,\r
             HttpServletRequest request) {\r
-        Mdc.begin(request, scheduleId);\r
-        log.info(LogMessages.CREATE_SCHEDULE_REQUEST, "Received", request.getRemoteAddr(), scheduleId,\r
+        Observation.report(LogMessages.CREATE_SCHEDULE_REQUEST, "Received", request.getRemoteAddr(), scheduleId,\r
                 scheduleMessage.toString());\r
         Response response = null;\r
         try {\r
@@ -208,25 +197,6 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
             if (immediate) {\r
                 createChangeManagementImmediate(schedule, scheduleMessage);\r
 \r
-                // *******************************************************************************************\r
-                // This flush does nothing because JPA is expecting\r
-                // JtaTransactionCoordinatorImpl\r
-                // rather than\r
-                // JdbcResourceLocalTransactionCoordinatorImpl\r
-                // (it does an instance of and JdbcResourceLocalTransactionCoordinatorImpl\r
-                // fails)\r
-                // SO the automatic approval and creation of tickets cannot\r
-                // rely retrieving the entities from the Schedule entity as the SQL has not yet\r
-                // executed.\r
-                // Under future flow, they can because the data is committed in a separate\r
-                // transaction\r
-                // Three choices\r
-                // 1. Pass domainData through all of the methods. ***\r
-                // 2. Re-structre the code to have @Transactionals which would break the top\r
-                // level rollback strategy\r
-                // 3. Debug JPA (Still worth doing, maybe some kind of goofy parameter.)\r
-                TransactionAspectSupport.currentTransactionStatus().flush();\r
-\r
                 // Create automatic approval\r
                 ApprovalMessage am = new ApprovalMessage();\r
                 am.setApprovalStatus(ApprovalStatusEnum.Accepted);\r
@@ -239,25 +209,15 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
             }\r
             response = Response.accepted().build();\r
         } catch (CMSException e) {\r
-            debug.debug(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());\r
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();\r
-            log.info(e.getMessage());\r
+               Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());\r
             response = Response.status(e.getStatus()).entity(e.getRequestError()).build();\r
-            Mdc.end(response);\r
-            audit.info(LogMessages.CREATE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId, "");\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();\r
             response = Response.serverError().build();\r
-            Mdc.end(response);\r
-            audit.info(LogMessages.CREATE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId, "");\r
         }\r
-        Mdc.end(response);\r
-        log.info(LogMessages.CREATE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId,\r
-                response.getStatusInfo().toString());\r
-        audit.info(LogMessages.CREATE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId,\r
-                response.getStatusInfo().toString());\r
-        metrics.info(LogMessages.CREATE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId,\r
+        Observation.report(LogMessages.CREATE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId,\r
                 response.getStatusInfo().toString());\r
         return response;\r
     }\r
@@ -326,7 +286,7 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
         } catch (CMSException e) {\r
             throw e;\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
             throw new CMSException(Status.INTERNAL_SERVER_ERROR, LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());\r
         }\r
         // If we got here, there are no change windows....\r
@@ -440,7 +400,7 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
                 try {\r
                     CmDomainDataEnum.valueOf(name);\r
                 } catch (Exception e) {\r
-                    log.warn(LogMessages.UNDEFINED_DOMAIN_DATA_ATTRIBUTE, DomainsEnum.ChangeManagement.name(), name,\r
+                    Observation.report(LogMessages.UNDEFINED_DOMAIN_DATA_ATTRIBUTE, DomainsEnum.ChangeManagement.name(), name,\r
                             value);\r
                 }\r
             }\r
@@ -456,9 +416,8 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
     @Override\r
     @Transactional\r
     public Response deleteScheduleRequest(String apiVersion, String scheduleId, HttpServletRequest request) {\r
-        Mdc.begin(request, scheduleId);\r
         Response response = null;\r
-        log.info(LogMessages.DELETE_SCHEDULE_REQUEST, "Received", request.getRemoteAddr(), scheduleId, "");\r
+        Observation.report(LogMessages.DELETE_SCHEDULE_REQUEST, "Received", request.getRemoteAddr(), scheduleId, "");\r
         try {\r
             Schedule schedule = scheduleDAO.findByDomainScheduleID(DomainsEnum.ChangeManagement.toString(), scheduleId);\r
             if (schedule == null) {\r
@@ -469,20 +428,14 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
             response = Response.noContent().build();\r
         } catch (CMSException e) {\r
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();\r
-            log.info(e.getMessage());\r
+            Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());\r
             response = Response.status(e.getStatus()).entity(e.getRequestError()).build();\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
-            debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();\r
             response = Response.serverError().build();\r
         }\r
-        Mdc.end(response);\r
-        log.info(LogMessages.DELETE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId,\r
-                response.getStatusInfo().toString());\r
-        audit.info(LogMessages.DELETE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId,\r
-                response.getStatusInfo().toString());\r
-        metrics.info(LogMessages.DELETE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId,\r
+        Observation.report(LogMessages.DELETE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId,\r
                 response.getStatusInfo().toString());\r
         return response;\r
     }\r
@@ -490,8 +443,7 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
     @Override\r
     public Response getScheduleRequestInfo(String apiVersion, String scheduleId, HttpServletRequest request) {\r
         Response response = null;\r
-        Mdc.begin(request, scheduleId);\r
-        log.info(LogMessages.GET_SCHEDULE_REQUEST_INFO, "Received", request.getRemoteAddr(), scheduleId, "");\r
+        Observation.report(LogMessages.GET_SCHEDULE_REQUEST_INFO, "Received", request.getRemoteAddr(), scheduleId, "");\r
         Schedule schedule = null;\r
         try {\r
             schedule = scheduleDAO.findByDomainScheduleID(DomainsEnum.ChangeManagement.toString(), scheduleId);\r
@@ -501,20 +453,13 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
             }\r
             response = Response.ok().entity(schedule).build();\r
         } catch (CMSException e) {\r
-            log.info(e.getMessage());\r
-            debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+            Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());\r
             response = Response.status(e.getStatus()).entity(e.getRequestError()).build();\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
-            debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
             response = Response.serverError().build();\r
         }\r
-        Mdc.end(response);\r
-        audit.info(LogMessages.GET_SCHEDULE_REQUEST_INFO, "Returned", request.getRemoteAddr(), scheduleId,\r
-                response.getStatusInfo().toString());\r
-        metrics.info(LogMessages.GET_SCHEDULE_REQUEST_INFO, "Returned", request.getRemoteAddr(), scheduleId,\r
-                response.getStatusInfo().toString());\r
-        log.info(LogMessages.GET_SCHEDULE_REQUEST_INFO, "Returned", request.getRemoteAddr(), scheduleId,\r
+        Observation.report(LogMessages.GET_SCHEDULE_REQUEST_INFO, "Returned", request.getRemoteAddr(), scheduleId,\r
                 response.getStatusInfo().toString());\r
         return response;\r
     }\r
@@ -524,8 +469,7 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
     public Response approveScheduleRequest(String apiVersion, String scheduleId, ApprovalMessage approval,\r
             HttpServletRequest request) {\r
         Response response = null;\r
-        Mdc.begin(request, scheduleId);\r
-        log.info(LogMessages.APPROVE_SCHEDULE_REQUEST, "Received", request.getRemoteAddr(), scheduleId,\r
+        Observation.report(LogMessages.APPROVE_SCHEDULE_REQUEST, "Received", request.getRemoteAddr(), scheduleId,\r
                 approval.toString());\r
         try {\r
             String domain = DomainsEnum.ChangeManagement.toString();\r
@@ -537,19 +481,14 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
             response = Response.noContent().build();\r
         } catch (CMSException e) {\r
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();\r
-            log.info(e.getMessage());\r
+            Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());\r
             response = Response.status(e.getStatus()).entity(e.getRequestError()).build();\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();\r
             response = Response.serverError().build();\r
         }\r
-        Mdc.end(response);\r
-        log.info(LogMessages.APPROVE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId, "");\r
-        audit.info(LogMessages.APPROVE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId,\r
-                response.getStatusInfo().toString());\r
-        metrics.info(LogMessages.APPROVE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId,\r
-                response.getStatusInfo().toString());\r
+        Observation.report(LogMessages.APPROVE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId, "");\r
         return response;\r
     }\r
 \r
@@ -645,14 +584,13 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
             Integer maxSchedules, String lastScheduleId, Integer concurrencyLimit, UriInfo uri,\r
             HttpServletRequest request) {\r
 \r
-        Mdc.begin(request, UUID.randomUUID().toString());\r
         Response response = null;\r
-        log.info(LogMessages.SEARCH_SCHEDULE_REQUEST_DETAILS, "Received", request.getRemoteAddr(),\r
+        Observation.report(LogMessages.SEARCH_SCHEDULE_REQUEST_DETAILS, "Received", request.getRemoteAddr(),\r
                 uri.getRequestUri().getQuery());\r
         List<CmDetailsMessage> schedules = new ArrayList<CmDetailsMessage>();\r
 \r
         try {\r
-            log.info("Timezone=" + TimeZone.getDefault());\r
+            debug.debug("Timezone={}" , TimeZone.getDefault());\r
             MultivaluedMap<String, String> qp = uri.getQueryParameters();\r
             StringBuilder where = new StringBuilder();\r
             int maxRows = 0;\r
@@ -673,20 +611,13 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
             }\r
             response = Response.ok(schedules.toArray(new CmDetailsMessage[schedules.size()])).build();\r
         } catch (CMSException e) {\r
-            debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
-            log.info(e.getMessage());\r
+            Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());\r
             response = Response.status(e.getStatus()).entity(e.getRequestError()).build();\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
-            debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
             response = Response.serverError().build();\r
         }\r
-        Mdc.end(response);\r
-        log.info(LogMessages.SEARCH_SCHEDULE_REQUEST_DETAILS, "Returned", request.getRemoteAddr(),\r
-                response.getStatusInfo().toString());\r
-        audit.info(LogMessages.SEARCH_SCHEDULE_REQUEST_DETAILS, "Returned", request.getRemoteAddr(),\r
-                response.getStatusInfo().toString());\r
-        metrics.info(LogMessages.SEARCH_SCHEDULE_REQUEST_DETAILS, "Returned", request.getRemoteAddr(),\r
+        Observation.report(LogMessages.SEARCH_SCHEDULE_REQUEST_DETAILS, "Returned", request.getRemoteAddr(),\r
                 response.getStatusInfo().toString());\r
         return response;\r
 \r
index a3a4ae8..0877a6b 100644 (file)
 package org.onap.optf.cmso.service.rs;\r
 \r
 import java.util.List;\r
-import java.util.UUID;\r
+\r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.ws.rs.core.Response;\r
 import javax.ws.rs.core.UriInfo;\r
-import org.onap.optf.cmso.common.Mdc;\r
+\r
 import org.onap.optf.cmso.model.ApprovalType;\r
 import org.onap.optf.cmso.model.dao.ApprovalTypeDAO;\r
 import org.onap.optf.cmso.optimizer.CMSOptimizerClient;\r
@@ -47,13 +47,13 @@ import org.onap.optf.cmso.ticketmgt.TmClient;
 import org.springframework.beans.factory.annotation.Autowired;\r
 import org.springframework.core.env.Environment;\r
 import org.springframework.stereotype.Controller;\r
+\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
 \r
 @Controller\r
 public class HealthCheckImpl implements HealthCheck {\r
-    private static EELFLogger log = EELFManager.getInstance().getLogger(HealthCheckImpl.class);\r
-    private static EELFLogger audit = EELFManager.getInstance().getAuditLogger();\r
+    private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();\r
 \r
     @Autowired\r
     TmClient tmClient;\r
@@ -72,8 +72,7 @@ public class HealthCheckImpl implements HealthCheck {
 \r
     @Override\r
     public Response healthCheck(String apiVersion, Boolean checkInterfaces, UriInfo uri, HttpServletRequest request) {\r
-        Mdc.begin(request, UUID.randomUUID().toString());\r
-        log.info("Entered healthcheck");\r
+        debug.debug("Entered healthcheck");\r
         Response response = null;\r
         HealthCheckMessage hc = new HealthCheckMessage();\r
         hc.setHealthy(true);\r
@@ -89,8 +88,6 @@ public class HealthCheckImpl implements HealthCheck {
             response = Response.ok().entity(hc).build();\r
         else\r
             response = Response.status(Response.Status.BAD_REQUEST).entity(hc).build();\r
-        Mdc.end(response);\r
-        audit.info("Healthcheck healthy={0}", hc.getHealthy().toString());\r
         return response;\r
     }\r
 \r
index 8cbe459..7a7821e 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Copyright © 2017-2019 AT&T Intellectual Property.\r
  * Modifications Copyright © 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
@@ -34,6 +34,7 @@ package org.onap.optf.cmso.sostatus;
 import java.text.SimpleDateFormat;\r
 import java.util.Date;\r
 import java.util.Map;\r
+\r
 import javax.ws.rs.ProcessingException;\r
 import javax.ws.rs.client.Client;\r
 import javax.ws.rs.client.ClientBuilder;\r
@@ -41,10 +42,12 @@ import javax.ws.rs.client.Invocation;
 import javax.ws.rs.client.WebTarget;\r
 import javax.ws.rs.core.MediaType;\r
 import javax.ws.rs.core.Response;\r
+\r
+import org.onap.observations.Mdc;\r
+import org.onap.observations.Observation;\r
 import org.onap.optf.cmso.common.BasicAuthenticatorFilter;\r
 import org.onap.optf.cmso.common.CMSStatusEnum;\r
 import org.onap.optf.cmso.common.LogMessages;\r
-import org.onap.optf.cmso.common.Mdc;\r
 import org.onap.optf.cmso.common.PropertiesManagement;\r
 import org.onap.optf.cmso.filters.CMSOClientFilters;\r
 import org.onap.optf.cmso.model.ChangeManagementSchedule;\r
@@ -59,6 +62,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;\r
 import org.springframework.stereotype.Component;\r
 import org.springframework.transaction.annotation.Transactional;\r
+\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
 import com.fasterxml.jackson.databind.ObjectMapper;\r
@@ -66,10 +70,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 \r
 @Component\r
 public class MsoStatusClient {\r
-    private static EELFLogger log = EELFManager.getInstance().getLogger(MsoStatusClient.class);\r
-    private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();\r
     private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();\r
-    private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();\r
 \r
     @Autowired\r
     ChangeManagementScheduleDAO cmScheduleDAO;\r
@@ -91,12 +92,12 @@ public class MsoStatusClient {
         try {\r
             ChangeManagementSchedule cmSchedule = cmScheduleDAO.lockOne(id);\r
             if (cmSchedule == null) {\r
-                log.warn(LogMessages.MSO_POLLING_MISSING_SCHEDULE, id.toString());\r
+                Observation.report(LogMessages.MSO_POLLING_MISSING_SCHEDULE, id.toString());\r
                 return;\r
             }\r
             poll(cmSchedule);\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
         }\r
         debug.debug(LogMessages.MSO_STATUS_JOB, "Exited", id.toString());\r
     }\r
@@ -120,10 +121,7 @@ public class MsoStatusClient {
             Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON);\r
             Response response = null;\r
             cmSchedule.setMsoTimeMillis(System.currentTimeMillis());\r
-            Mdc.metricStart(requestId, url);\r
             response = invocationBuilder.get();\r
-            Mdc.metricEnd(response);\r
-            metrics.info(LogMessages.SO_API, requestId);\r
             switch (response.getStatus()) {\r
                 case 200: {\r
                     String respString = response.readEntity(String.class);\r
@@ -136,7 +134,7 @@ public class MsoStatusClient {
                         try {\r
                             msoStatus = MSO_STATUS.valueOf(resp.getRequestState());\r
                         } catch (Exception e) {\r
-                            errors.error("Unregcognized status from MSO: " + resp.getRequestState());\r
+                               Observation.report(LogMessages.UNRECOGNIZED_MSO_STATUS, resp.getRequestState());\r
                         }\r
                         long finishTime = getFinishTime(resp);\r
                         switch (msoStatus) {\r
@@ -185,15 +183,13 @@ public class MsoStatusClient {
                 }\r
             }\r
         } catch (ProcessingException e) {\r
-            debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
             // Probably a transient error... Keep polling\r
             cmSchedule.setMsoTimeMillis(System.currentTimeMillis());\r
             cmSchedule.setMsoStatus("ConnectionException");\r
             cmSchedule.setMsoMessage("Could not call MSO:" + e.getMessage());\r
         } catch (Exception e) {\r
-            debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
             // Probably a transient error... Keep polling\r
             cmSchedule.setMsoTimeMillis(System.currentTimeMillis());\r
             cmSchedule.setMsoStatus("Exception");\r
@@ -216,8 +212,7 @@ public class MsoStatusClient {
                 Date dateTime = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z").parse(timestr);\r
                 finishTime = dateTime.getTime();\r
             } catch (Exception e) {\r
-                debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, "Unable to parse MSO fisnish timestamp: " + timestr);\r
-                errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, "Unable to parse MSO fisnish timestamp: " + timestr);\r
+               Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, "Unable to parse MSO finish timestamp: " + timestr);\r
             }\r
         }\r
         return finishTime;\r
@@ -238,8 +233,7 @@ public class MsoStatusClient {
                     om.treeToValue(requestStatus, MsoOrchestrationQueryResponse.class);\r
             return msoResponse;\r
         } catch (Exception e) {\r
-            log.warn("Exception parsing MSO response", e);\r
-            log.warn("MSO response:\n" + resp);\r
+               Observation.report(LogMessages.UNABLE_TO_PARSE_MSO_RESPONSE, e, e.getMessage(), resp);\r
         }\r
         return null;\r
     }\r
@@ -260,14 +254,13 @@ public class MsoStatusClient {
 \r
         Client client = ClientBuilder.newClient();\r
         client.register(new BasicAuthenticatorFilter(user, pass));\r
+        client.register(new CMSOClientFilters());\r
+\r
         WebTarget target = client.target(url);\r
         Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON);\r
         Response response = null;\r
         try {\r
-            Mdc.metricStart(requestId, url);\r
             response = invocationBuilder.get();\r
-            Mdc.metricEnd(response);\r
-            metrics.info(LogMessages.SO_API, requestId);\r
             switch (response.getStatus()) {\r
                 case 200:\r
                 case 204:\r
index 29853d1..df9f361 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright © 2017-2019 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -31,8 +31,8 @@
 \r
 package org.onap.optf.cmso.sostatus;\r
 \r
+import org.onap.observations.Mdc;\r
 import org.onap.optf.cmso.common.LogMessages;\r
-import org.onap.optf.cmso.common.Mdc;\r
 import org.onap.optf.cmso.model.ChangeManagementSchedule;\r
 import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;\r
 import org.quartz.DisallowConcurrentExecution;\r
index cd74bc4..c3254aa 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright © 2017-2019 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -33,17 +33,21 @@ package org.onap.optf.cmso.sostatus;
 \r
 import java.util.List;\r
 import java.util.Map;\r
+\r
 import javax.ws.rs.client.Client;\r
 import javax.ws.rs.client.ClientBuilder;\r
 import javax.ws.rs.client.Invocation;\r
 import javax.ws.rs.client.WebTarget;\r
 import javax.ws.rs.core.MediaType;\r
 import javax.ws.rs.core.Response;\r
+\r
+import org.onap.observations.Mdc;\r
+import org.onap.observations.Observation;\r
 import org.onap.optf.cmso.common.BasicAuthenticatorFilter;\r
 import org.onap.optf.cmso.common.DomainsEnum;\r
 import org.onap.optf.cmso.common.LogMessages;\r
-import org.onap.optf.cmso.common.Mdc;\r
 import org.onap.optf.cmso.common.PropertiesManagement;\r
+import org.onap.optf.cmso.filters.CMSOClientFilters;\r
 import org.onap.optf.cmso.model.ChangeManagementSchedule;\r
 import org.onap.optf.cmso.model.Schedule;\r
 import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;\r
@@ -56,6 +60,7 @@ import org.quartz.SchedulerException;
 import org.springframework.beans.factory.annotation.Autowired;\r
 import org.springframework.core.env.Environment;\r
 import org.springframework.stereotype.Component;\r
+\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
 \r
@@ -67,10 +72,7 @@ import com.att.eelf.configuration.EELFManager;
 @Component\r
 @DisallowConcurrentExecution\r
 public class ScheduleStatusJob implements Job {\r
-    private static EELFLogger log = EELFManager.getInstance().getLogger(ScheduleStatusJob.class);\r
-    private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();\r
     private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();\r
-    private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();\r
 \r
     @Autowired\r
     ScheduleDAO scheduleDAO;\r
@@ -95,7 +97,7 @@ public class ScheduleStatusJob implements Job {
                 dispatchMso(s.getId());\r
             }\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
         }\r
         try {\r
 \r
@@ -107,7 +109,7 @@ public class ScheduleStatusJob implements Job {
                 dispatchScheduleStatusChecker(s.getId());\r
             }\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
         }\r
         debug.debug(LogMessages.SCHEDULE_STATUS_JOB, "Exited");\r
     }\r
@@ -122,17 +124,15 @@ public class ScheduleStatusJob implements Job {
             String pass = pm.getProperty("mechid.pass", "");\r
             Client client = ClientBuilder.newClient();\r
             client.register(new BasicAuthenticatorFilter(user, pass));\r
+            client.register(CMSOClientFilters.class);\r
             WebTarget target = client.target(url);\r
             Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON);\r
             Response response = null;\r
             try {\r
-                Mdc.metricStart(id.toString(), url);\r
                 response = invocationBuilder.get();\r
-                Mdc.metricEnd(response);\r
-                metrics.info(LogMessages.SCHEDULE_STATUS_JOB, id.toString());\r
                 switch (response.getStatus()) {\r
                     case 200:\r
-                        log.info("Returned from dispatch call");\r
+                        debug.debug("Returned from dispatch call");\r
                         break;\r
                     case 400: // Bad request\r
                     default: {\r
@@ -142,12 +142,10 @@ public class ScheduleStatusJob implements Job {
                     }\r
                 }\r
             } catch (Exception e) {\r
-                debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
-                errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+                Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
             }\r
         } catch (Exception e) {\r
-            debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
         } finally {\r
             Mdc.restore(mdcSave);\r
         }\r
@@ -164,17 +162,15 @@ public class ScheduleStatusJob implements Job {
             String pass = pm.getProperty("mechid.pass", "");\r
             Client client = ClientBuilder.newClient();\r
             client.register(new BasicAuthenticatorFilter(user, pass));\r
+            client.register(CMSOClientFilters.class);\r
             WebTarget target = client.target(url);\r
             Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON);\r
             Response response = null;\r
             try {\r
-                Mdc.metricStart(id.toString(), url);\r
                 response = invocationBuilder.get();\r
-                Mdc.metricEnd(response);\r
-                metrics.info(LogMessages.SCHEDULE_STATUS_JOB, id.toString());\r
                 switch (response.getStatus()) {\r
                     case 200:\r
-                        log.info("Returned from dispatch call");\r
+                        debug.debug("Returned from dispatch call");\r
                         break;\r
                     case 400: // Bad request\r
                     default: {\r
@@ -184,12 +180,10 @@ public class ScheduleStatusJob implements Job {
                     }\r
                 }\r
             } catch (Exception e) {\r
-                debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
-                errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+                Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
             }\r
         } catch (Exception e) {\r
-            debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
         } finally {\r
             Mdc.restore(mdcSave);\r
         }\r
index b8aed57..c3b9be8 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
+ * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright Â© 2018 IBM.\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -38,6 +38,7 @@ import java.util.Iterator;
 import java.util.List;\r
 import java.util.Map;\r
 import java.util.UUID;\r
+\r
 import javax.ws.rs.ProcessingException;\r
 import javax.ws.rs.client.Client;\r
 import javax.ws.rs.client.ClientBuilder;\r
@@ -47,12 +48,14 @@ import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.MediaType;\r
 import javax.ws.rs.core.Response;\r
 import javax.ws.rs.core.Response.Status;\r
-import org.apache.commons.lang3.text.StrSubstitutor;\r
+\r
+import org.apache.commons.text.StringSubstitutor;\r
 import org.joda.time.format.ISODateTimeFormat;\r
+import org.onap.observations.Mdc;\r
+import org.onap.observations.Observation;\r
 import org.onap.optf.cmso.common.BasicAuthenticatorFilter;\r
 import org.onap.optf.cmso.common.CmHelpers;\r
 import org.onap.optf.cmso.common.LogMessages;\r
-import org.onap.optf.cmso.common.Mdc;\r
 import org.onap.optf.cmso.common.PropertiesManagement;\r
 import org.onap.optf.cmso.common.exceptions.CMSException;\r
 import org.onap.optf.cmso.filters.CMSOClientFilters;\r
@@ -72,6 +75,7 @@ import org.onap.optf.cmso.ticketmgt.bean.TmChangeInfo;
 import org.springframework.beans.factory.annotation.Autowired;\r
 import org.springframework.core.env.Environment;\r
 import org.springframework.stereotype.Component;\r
+\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
 import com.fasterxml.jackson.databind.JsonNode;\r
@@ -81,9 +85,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 \r
 @Component\r
 public class TmClient {\r
-    private static EELFLogger log = EELFManager.getInstance().getLogger(TmClient.class);\r
-    private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();\r
-    private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();\r
     private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();\r
 \r
     @Autowired\r
@@ -153,12 +154,12 @@ public class TmClient {
                 }\r
                     break;\r
                 default: {\r
-                    errors.error(LogMessages.UNEXPECTED_RESPONSE, "TM", String.valueOf(response.getStatus()),\r
+                    Observation.report(LogMessages.UNEXPECTED_RESPONSE, "TM", String.valueOf(response.getStatus()),\r
                             response.toString());\r
                 }\r
             }\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e.toString());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e.toString());\r
         } finally {\r
             Mdc.restore(mdcSave);\r
         }\r
@@ -225,10 +226,10 @@ public class TmClient {
         try {\r
             Response response = null;\r
             debug.debug("postCloseChangeTicket {}", closeChangeRecord.asText());\r
-            log.info(LogMessages.TM_CLOSE_CHANGE_RECORD, "Begin", scheduleId, changeId);\r
+            Observation.report(LogMessages.TM_CLOSE_CHANGE_RECORD, "Begin", scheduleId, changeId);\r
             // response = vtmPost(url, closeChangeRecord, scheduleId);\r
             response = tmPost(Endpoint.CLOSE, closeChangeRecord, scheduleId);\r
-            log.info(LogMessages.TM_CLOSE_CHANGE_RECORD, "End", scheduleId, changeId);\r
+            Observation.report(LogMessages.TM_CLOSE_CHANGE_RECORD, "End", scheduleId, changeId);\r
             switch (response.getStatus()) {\r
                 case 200: {\r
                     String resp = response.readEntity(String.class);\r
@@ -239,7 +240,7 @@ public class TmClient {
                     String respString = response.readEntity(String.class);\r
                     debug.debug("response=" + respString);\r
                     if (!isAlreadyClosed(respString)) {\r
-                        errors.error(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),\r
+                        Observation.report(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),\r
                                 response.toString() + " : " + respString);\r
                         throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_CLOSE_CHANGE_TICKET,\r
                                 scheduleId, changeId, respString);\r
@@ -248,14 +249,14 @@ public class TmClient {
                     break;\r
                 default: {\r
                     String message = response.readEntity(String.class);\r
-                    errors.error(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),\r
+                    Observation.report(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),\r
                             response.toString() + " : " + message);\r
                     throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_CLOSE_CHANGE_TICKET,\r
                             scheduleId, changeId, message);\r
                 }\r
             }\r
         } catch (ProcessingException e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
             throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_CLOSE_CHANGE_TICKET, scheduleId,\r
                     changeId, e.toString());\r
         } finally {\r
@@ -283,7 +284,7 @@ public class TmClient {
                 }\r
             }\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
         }\r
         return false;\r
     }\r
@@ -351,7 +352,7 @@ public class TmClient {
         for (String name : variables.keySet()) {\r
             Object value = variables.get(name);\r
             if (value instanceof String) {\r
-                StrSubstitutor sub = new StrSubstitutor(variables);\r
+                StringSubstitutor sub = new StringSubstitutor(variables);\r
                 value = sub.replace(value.toString());\r
                 variables.put(name, value);\r
             }\r
@@ -366,10 +367,10 @@ public class TmClient {
         try {\r
             Response response = null;\r
             debug.debug("postCreateChangeTicket {}", createChangeRecord.toString());\r
-            log.info(LogMessages.TM_CREATE_CHANGE_RECORD, "Begin", scheduleId);\r
+            Observation.report(LogMessages.TM_CREATE_CHANGE_RECORD, "Begin", scheduleId);\r
             // response = vtmPost(url, createChangeRecord, scheduleId);\r
             response = tmPost(Endpoint.CREATE, createChangeRecord, scheduleId);\r
-            log.info(LogMessages.TM_CREATE_CHANGE_RECORD, "End", scheduleId);\r
+            Observation.report(LogMessages.TM_CREATE_CHANGE_RECORD, "End", scheduleId);\r
             switch (response.getStatus()) {\r
                 case 200: {\r
                     ObjectNode json = response.readEntity(ObjectNode.class);\r
@@ -382,7 +383,7 @@ public class TmClient {
                             debug.debug("ChangeId=" + changeId);\r
                         }\r
                     } else {\r
-                        errors.error(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),\r
+                        Observation.report(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),\r
                                 response.toString() + " : " + "Response is empty");\r
                         throw new CMSException(Status.EXPECTATION_FAILED, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET,\r
                                 scheduleId, "Response is empty");\r
@@ -391,14 +392,14 @@ public class TmClient {
                     break;\r
                 default: {\r
                     String message = response.readEntity(String.class);\r
-                    errors.error(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),\r
+                    Observation.report(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),\r
                             response.toString() + " : " + message);\r
                     throw new CMSException(Status.EXPECTATION_FAILED, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET,\r
                             scheduleId, message);\r
                 }\r
             }\r
         } catch (ProcessingException e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
             throw new CMSException(Status.EXPECTATION_FAILED, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET, scheduleId,\r
                     e.toString());\r
         } finally {\r
@@ -415,10 +416,10 @@ public class TmClient {
 \r
             Response response = null;\r
             debug.debug("postUpdateChangeTicket {}", updateChangeRecord.toString());\r
-            log.info(LogMessages.TM_UPDATE_CHANGE_RECORD, "Begin", scheduleId, changeId, url);\r
+            Observation.report(LogMessages.TM_UPDATE_CHANGE_RECORD, "Begin", scheduleId, changeId, url);\r
             // response = vtmPost(url, updateChangeRecord, scheduleId);\r
             response = tmPost(Endpoint.UPDATE, updateChangeRecord, scheduleId);\r
-            log.info(LogMessages.TM_UPDATE_CHANGE_RECORD, "End", scheduleId, changeId, url);\r
+            Observation.report(LogMessages.TM_UPDATE_CHANGE_RECORD, "End", scheduleId, changeId, url);\r
             switch (response.getStatus()) {\r
                 case 200: {\r
                     String resp = response.readEntity(String.class);\r
@@ -427,14 +428,14 @@ public class TmClient {
                     break;\r
                 default: {\r
                     String message = response.readEntity(String.class);\r
-                    errors.error(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),\r
+                    Observation.report(LogMessages.UNEXPECTED_RESPONSE, "vTM", String.valueOf(response.getStatus()),\r
                             response.toString() + " : " + message);\r
                     throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_UPDATE_CHANGE_TICKET,\r
                             scheduleId, changeId, message);\r
                 }\r
             }\r
         } catch (ProcessingException e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
             throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.UNABLE_TO_UPDATE_CHANGE_TICKET, scheduleId,\r
                     changeId, e.toString());\r
         } finally {\r
@@ -460,16 +461,13 @@ public class TmClient {
             ObjectMapper mapper = new ObjectMapper();\r
             String jsonRequest = mapper.writeValueAsString(request);\r
             debug.debug("vTM URL = " + url + " user=" + user + " : " + jsonRequest);\r
-            Mdc.metricStart(scheduleId, url);\r
             response = invocationBuilder.post(Entity.json(request));\r
-            Mdc.metricEnd(response);\r
-            metrics.info(LogMessages.TM_API, url);\r
             // String message = response.readEntity(String.class);\r
             // debug.debug("Return from " + url + " : " + response.toString() + "\n" +\r
             // message);\r
             debug.debug("Return from " + url + " : " + response.toString());\r
         } catch (Exception e) {\r
-            errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.toString());\r
+            Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.toString());\r
             throw new CMSException(Status.INTERNAL_SERVER_ERROR, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET, scheduleId,\r
                     e.getMessage());\r
         }\r
@@ -496,24 +494,21 @@ public class TmClient {
                 ObjectMapper mapper = new ObjectMapper();\r
                 String jsonRequest = mapper.writeValueAsString(request);\r
                 debug.debug("TM URL = " + url + " user=" + user + " : " + jsonRequest);\r
-                Mdc.metricStart(scheduleId, url);\r
                 response = invocationBuilder.post(Entity.json(request));\r
-                Mdc.metricEnd(response);\r
-                metrics.info(LogMessages.TM_API, url);\r
                 // String message = response.readEntity(String.class);\r
                 // debug.debug("Return from " + url + " : " + response.toString() + "\n" +\r
                 // message);\r
                 debug.debug("Return from " + url + " : " + response.toString());\r
                 return response;\r
             } catch (ProcessingException e) {\r
-                errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.toString());\r
+                Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.toString());\r
                 url = tmEndpoints.getNextEndpoint(ep, endpoints);\r
                 if (url == null || !tryNextURL(e)) {\r
                     throw new CMSException(Status.INTERNAL_SERVER_ERROR, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET,\r
                             scheduleId, e.getMessage());\r
                 }\r
             } catch (Exception e) {\r
-                errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.toString());\r
+                Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.toString());\r
                 throw new CMSException(Status.INTERNAL_SERVER_ERROR, LogMessages.UNABLE_TO_CREATE_CHANGE_TICKET,\r
                         scheduleId, e.getMessage());\r
             }\r
diff --git a/cmso-service/src/main/resources/aaf/AAFUserRoles.properties b/cmso-service/src/main/resources/aaf/AAFUserRoles.properties
new file mode 100644 (file)
index 0000000..e7fc221
--- /dev/null
@@ -0,0 +1 @@
+/**=org.onap.oof.access|*|get  ALL
\ No newline at end of file
diff --git a/cmso-service/src/main/resources/aaf/org.onap.oof.cred.props b/cmso-service/src/main/resources/aaf/org.onap.oof.cred.props
new file mode 100644 (file)
index 0000000..21945b8
--- /dev/null
@@ -0,0 +1,11 @@
+############################################################
+# Properties Generated by AT&T Certificate Manager
+#   by root
+#   on 2019-02-15T21:01:19.868+0000
+# @copyright 2016, AT&T
+############################################################
+aaf_id=oof@oof.onap.org
+aaf_password=demo123456!
+cadi_keyfile=src/main/resources/aaf/org.onap.oof.keyfile
+cadi_truststore=src/main/resources/aaf/truststoreONAPall.jks
+#cadi_truststore_password=enc:erNqS33_5xn_bwcaroba7NvYfPLpPUYxqzw3rdwGTY7jbnygOTyQ-R6dpSC_3iPOomp-rqZkHgMGImiUk9DFPr
diff --git a/cmso-service/src/main/resources/aaf/org.onap.oof.keyfile b/cmso-service/src/main/resources/aaf/org.onap.oof.keyfile
new file mode 100644 (file)
index 0000000..f85a567
--- /dev/null
@@ -0,0 +1,27 @@
+liD-IR8Y1MHqPDTUqq3AaTtqnWn5jCpfIRBlyi6xY4A0fbQz8ZPlTZPHkshRt0dHdST3R7TIvTyQ
+JpTCeBNBu2df3vBbUzsN0rIpPG9TGjzmE7cRu4V4kfefSqsIj-S7OTAaWaWpwGWJYLLCB2sQALkS
+f68VWdupUEw3g9jqCU1QzjKOnLGvhlp6Qrc1xG4Z5Ar8WERw-C3DqTWUKANoEvjWkvH2rAywzj93
+pmspvd5fQfH1rp1ACNvnPrRb_oYNfwPrNpE7Sb4LvM1muoiKMDF64IDO0TkxhjHZ9wpJgVsnowby
+qmokqf39dMRRk3S1IEpOiBGyLS_885JDj_XJKYRQsjvkTzjpFJ7wE2-HDZEVWCITvtS9-Xorm5TI
+3iU4rjMDew5fkBnjoKuSOS7Lksva4ouZOCiUkDos1jAJ5XMDEQm4BcPHtcW6PpC602-qRcgnNjjP
+wOPdF7hCm27ZTai3lAtNGByR7oBr9r5Uma-soORFvg8drV8Rgh0lax-poFVhoEH7RhKPIzYpSco9
+jnpURzi_epTjAhjjup-erTv2GAIllKsSEHZLbfsFWlNUZTOx58PSB0jBN5m_8HxTyNm0zsm0Cb7U
+KsjPduQ5ZblsfRIJwqpOBXoof7WerKReMZSOdgjZUNueiuEImVH9_SYOdKZhkluSi4yfEtme7CCP
+kZ2JhdiT5km3SeonalhU2MUsx60krxyQ1mnjI4jS9QagUME4mujdvM_L7mtjcPZVSfXUn49whakE
+J-NQV6q2iZgN2IxsT_uCnlZYwnE5i-IbQkQAEu13m6ETsMmf0cwPnKaSwRhb8G48EkJhTL-GP9Z0
+-EsIKT7lQt7kfX-mmNoEirTg9gQAaN3uxLmdHvXpeJdlETnnaLYYJJ3h-SL0e_5Yz2SpdsEwZ3Bk
+PtR-QvlYKDhG1nhPOna65ctCzn81PZOUP3lsO6MSTOK6D6Taxfh1TYEBAvzCP0BfFBodw4lSglFP
+I5IfdiJmomTGARa36nC_O5YzH_jBWLQrgd2gxI5H5bB-5zqzu79SGX9o2_LRVY_LVV0BmI3xSYOI
+vziYYC1XyTY6blfdiOM5a5KjraErxSTEFZVFrsx4OQ_dLA0woVtixawrIy1rgfQr49U1oIRe8BgN
+j3eis_UQAbPbmdbEe1qtXnvi6T7trHskzt6K-vTgo5ITJkr-F2Sds_QgNdaFBGuES6X5RwRGlbHT
+Tl_M8Ja_1K-RMNKJRssoRTKstpwnrhk9IcoSwYcLykbDLgeC0mhSMHOOuWv1RGRaZdzObc5YA1eB
+idQmzy5xAHzNxPHHrB-fpjFJRYv_QZY9qZcGvP58d6bHO0upxbj-BBt9zfc7Qt0JLU6EAdYbW5TI
+2v4JImikrx6KvtoK8vcjJMTDAanTVB31J65tat0rq9wYKxUdjBJLzkT3psYs_DRtYQc0i02YTD7t
+dWya0-3p1Yrt0em3XGb8JAh2PA3BsQKmvKAOc054wf_B8n8saxSFw1WQL30vU5c4-Z_p53HfaUYd
+Qg7DZskzgwBRy48sLJNCrn81RtxXfQP1XtPEZs-AAlTUslHoUdoQ1cwrYEgkNT1cjk6sLI_oKSK-
+dDICBnlYLrZRBS3sH8K38WaIh1WRY6vbGVDs1tUectUpng_-Khavd0Crw7D_CE6T7Rnfcn0pnTV-
+HW1PIXejFsONQn-2c3a9HZ-v6Hg4JL6UWm-qgBPC5118ymO0LfmrviAFAC6Wt3WFiNzrvx9Jggus
+lE0qvLVfkQVZXAy-hSPHlYZmtxk5voVsf60qPoDN2-NdpWz62M9PrXd_A03YGxzt0G6J4VXExRES
+xqLeGNGB496AfX_vEub97sR8xcbbUXsyt12uVnygifGyND60coikaKrMktv2OLOLEl8AudLp0ZNA
+oOoYJZqfUnQqaLt0dNmNa5OtzYjf7f6bYX0V8XLTHlFqZ6QzqYGFMPNhDYjqtet6d--Q8t7_5S5C
+RfXP8Wh8CjbEh2_rsr9rvy1nhM_Cptxc0BFXcS5Dt_R4vjd2G4B_LEC4Hy1s_rZThzUVxRCl
\ No newline at end of file
diff --git a/cmso-service/src/main/resources/aaf/org.onap.oof.location.props b/cmso-service/src/main/resources/aaf/org.onap.oof.location.props
new file mode 100644 (file)
index 0000000..d4a48df
--- /dev/null
@@ -0,0 +1,8 @@
+############################################################
+# Properties Generated by AT&T Certificate Manager
+#   by root
+#   on 2019-02-15T21:01:19.861+0000
+# @copyright 2016, AT&T
+############################################################
+cadi_latitude=0.00
+cadi_longitude=0.00
diff --git a/cmso-service/src/main/resources/aaf/org.onap.oof.props b/cmso-service/src/main/resources/aaf/org.onap.oof.props
new file mode 100644 (file)
index 0000000..766c354
--- /dev/null
@@ -0,0 +1,14 @@
+############################################################
+# Properties Generated by AT&T Certificate Manager
+#   by root
+#   on 2019-02-15T21:01:19.866+0000
+# @copyright 2016, AT&T
+############################################################
+aaf_id=oof@oof.onap.org
+aaf_locate_url=https://aaf-onap-test.osaaf.org:8095
+aaf_url=https://AAF_LOCATE_URL/AAF_NS.service:2.1
+cadi_etc_dir=etc/config
+cadi_latitude=0.00
+cadi_longitude=0.00
+cadi_prop_files=src/main/resources/aaf/org.onap.oof.location.props;src/main/resources/aaf/org.onap.oof.cred.props
+cm_url=https://AAF_LOCATE_URL/AAF_NS.cm:2.1
diff --git a/cmso-service/src/main/resources/aaf/truststoreONAPall.jks b/cmso-service/src/main/resources/aaf/truststoreONAPall.jks
new file mode 100644 (file)
index 0000000..ff844b1
Binary files /dev/null and b/cmso-service/src/main/resources/aaf/truststoreONAPall.jks differ
index fb3ee01..0cdbf57 100644 (file)
@@ -60,3 +60,4 @@ com.att.eelf.logging.file=logback.xml
 com.att.eelf.logging.path=\r
 \r
 logging.config=\r
+spring.profiles.active=proprietary-auth
\ No newline at end of file
index 09d9312..e339117 100644 (file)
@@ -1,83 +1,59 @@
-#-------------------------------------------------------------------------------\r
-# Copyright © 2017-2018 AT&T Intellectual Property.\r
-# Modifications Copyright © 2018 IBM.\r
-# \r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-# \r
-#         http://www.apache.org/licenses/LICENSE-2.0\r
-# \r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-# \r
-# \r
-# Unless otherwise specified, all documentation contained herein is licensed\r
-# under the Creative Commons License, Attribution 4.0 Intl. (the â??Licenseâ?\9d);\r
-# you may not use this documentation except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-# \r
-#         https://creativecommons.org/licenses/by/4.0/\r
-# \r
-# Unless required by applicable law or agreed to in writing, documentation\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-#-------------------------------------------------------------------------------\r
-\r
-# Generated from org.onap.optf.cmso.common.LogMessages\r
-SEARCH_SCHEDULE_REQUEST_DETAILS SEARCH_SCHEDULE_REQUEST_DETAILS|Search Schedule Request Details {0} from {1}: {2}|No resolution needed|No action is required\r
-SEARCH_SCHEDULE_REQUEST SEARCH_SCHEDULE_REQUEST|Search Schedule Request {0} from {1}: {2} : {3}|No resolution needed|No action is required\r
-CREATE_SCHEDULE_REQUEST CREATE_SCHEDULE_REQUEST|Create Schedule Request {0} from {1}: {2} : {3}|No resolution needed|No action is required\r
-DELETE_SCHEDULE_REQUEST DELETE_SCHEDULE_REQUEST|Delete Schedule Request {0} from {1}: {2} : {3}|No resolution needed|No action is required\r
-GET_SCHEDULE_REQUEST_INFO GET_SCHEDULE_REQUEST_INFO|Get Schedule Request Info {0} from {1}: {2} : {3}|No resolution needed|No action is required\r
-PROCESS_OPTIMIZER_CALLBACK PROCESS_OPTIMIZER_CALLBACK|Change management optimizer callback {0} from {1}: {2} |No resolution needed|No action is required\r
-APPROVE_SCHEDULE_REQUEST APPROVE_SCHEDULE_REQUEST|Approve Schedule Request {0} from {1}: {2} : {3}|No resolution needed|No action is required\r
-SCHEDULE_ALREADY_EXISTS SCHEDULE_ALREADY_EXISTS|Schedule already exists domain={0} schedule id={1}|No resolution needed|No action is required\r
-SCHEDULE_NOT_FOUND SCHEDULE_NOT_FOUND|Schedule not found domain={0} schedule id={1}|No resolution needed|No action is required\r
-INVALID_ATTRIBUTE INVALID_ATTRIBUTE|Invalid attribute {0}={1}|No resolution needed|No action is required\r
-MISSING_REQUIRED_ATTRIBUTE MISSING_REQUIRED_ATTRIBUTE|Missing required attribute '{0}'|No resolution needed|No action is required\r
-INVALID_REQUEST INVALID_REQUEST|The input data structure is incorrect|No resolution needed|No action is required\r
-REQUEST_TIMED_OUT REQUEST_TIMED_OUT|Request timed out.|No resolution needed|No action is required\r
-UNEXPECTED_EXCEPTION UNEXPECTED_EXCEPTION|Unexpected exception encountered during processing. Please contact support : {0}|No resolution needed|No action is required\r
-AUTHORIZATION_FAILED AUTHORIZATION_FAILED|Authorization Failed|No resolution needed|No action is required\r
-UNDEFINED_DOMAIN_DATA_ATTRIBUTE UNDEFINED_DOMAIN_DATA_ATTRIBUTE|Domain data attribute not defined domain={0} name={1} value={2}|No resolution needed|No action is required\r
-UNDEFINED_FILTER_ATTRIBUTE UNDEFINED_FILTER_ATTRIBUTE|Undefined filter attribute {0}|No resolution needed|No action is required\r
-INVALID_DATE_FILTER INVALID_DATE_FILTER|Invalid date filter provided {0}=(1}|No resolution needed|No action is required\r
-OPTIMIZER_QUARTZ_JOB OPTIMIZER_QUARTZ_JOB|Quartz scheduling of OptimizerQuartzJob: {0}|No resolution needed|No action is required\r
-OPTIMIZER_EXCEPTION OPTIMIZER_EXCEPTION|Exception making client call to optimizer {0}|No resolution needed|No action is required\r
-OPTIMIZER_CALLBACK_STATE_ERROR OPTIMIZER_CALLBACK_STATE_ERROR|Optimizer callback on schedule in invalid state. Should be {0} but was {1}.|No resolution needed|No action is required\r
-CHANGE_MANAGEMENT_GROUP_NOT_FOUND CHANGE_MANAGEMENT_GROUP_NOT_FOUND|ChangeManagementGroup not found on optimizer callback scheduleId={0} groupId={1}|No resolution needed|No action is required\r
-UNABLE_TO_ALLOCATE_VNF_TIMESLOTS UNABLE_TO_ALLOCATE_VNF_TIMESLOTS|Unable to allocate VNF timeslots with Optimizer results startTime={0}, latestStartTime={1}, totalDuration={2}, concurrency={3} nvfs={4}|No resolution needed|No action is required\r
-UNABLE_TO_LOCATE_SCHEDULE_DETAIL UNABLE_TO_LOCATE_SCHEDULE_DETAIL|Unable to locate ChangeManagementSchedule for VNF. scheduleId={0}, groupId={1}, vnfName={2}|No resolution needed|No action is required\r
-CM_JOB CM_JOB|Quartz scheduling of CmJob: {0}|No resolution needed|No action is required\r
-CM_QUARTZ_JOB CM_QUARTZ_JOB|Quartz scheduling of CmQuartzJob: {0}|No resolution needed|No action is required\r
-NOT_PENDING_APPROVAL NOT_PENDING_APPROVAL|Approval request received for schedule that is not in Pending Approval state: domain={0} scheduleId={1} state={3}|No resolution needed|No action is required\r
-SCHEDULE_PAST_DUE SCHEDULE_PAST_DUE|Attempt to dispatch an event that is Past due scheduleId={0}, vnf={1}, now={2}, startTime={3}|No resolution needed|No action is required\r
-MSO_POLLING_MISSING_SCHEDULE MSO_POLLING_MISSING_SCHEDULE|Attempt to poll MSO for request id {1} for missing ChangeManagementSchedule id={0}|No resolution needed|No action is required\r
-MSO_STATUS_JOB MSO_STATUS_JOB|Polling MSO {0} for requestId={1} for id={2}|No resolution needed|No action is required\r
-UNEXPECTED_RESPONSE UNEXPECTED_RESPONSE|Unexpected response from {0} HTTP Status={1} : {2}|No resolution needed|No action is required\r
-SCHEDULE_STATUS_JOB SCHEDULE_STATUS_JOB|Quartz scheduling of ScheduleStatusJob: {0}|No resolution needed|No action is required\r
-CM_TICKET_NOT_APPROVED CM_TICKET_NOT_APPROVED|Attempt to dispatch a change management event that has no TM Ticket approved. scheduleId={0} VNF Name={1} TM ChangeId={2} Status={3} Approval Status={4}|No resolution needed|No action is required\r
-MULTIPLE_GROUPS_NOT_SUPPORTED MULTIPLE_GROUPS_NOT_SUPPORTED|Multiple groups not supported on immediate requests|No resolution needed|No action is required\r
-TM_CREATE_CHANGE_RECORD TM_CREATE_CHANGE_RECORD|TM Create Change Record:{0} : Schedule ID: {1}|No resolution needed|No action is required\r
-TM_LIST TM_LIST|TM list:{0} : URL : {1}|No resolution needed|No action is required\r
-TM_API TM_API|TM API Call: URL : {0}|No resolution needed|No action is required\r
-UNABLE_TO_CREATE_CHANGE_TICKET UNABLE_TO_CREATE_CHANGE_TICKET|Unable to create change ticket in TM: Schedule ID: {0} : Reason : {1}|No resolution needed|No action is required\r
-TM_UPDATE_CHECKLIST TM_UPDATE_CHECKLIST|TM Fetch Checklist:{0} : Schedule ID: {1} : Change Id : {2} : URL : {3}|No resolution needed|No action is required\r
-OPTIMIZER_REQUEST OPTIMIZER_REQUEST|Optimi Request:{0} : Schedule ID: {1} : URL : {2}|No resolution needed|No action is required\r
-TM_CLOSE_CHANGE_RECORD TM_CLOSE_CHANGE_RECORD|TM Close Change Record:{0} : Schedule ID: {1} : Change Id : {2}|No resolution needed|No action is required\r
-UNABLE_TO_CLOSE_CHANGE_TICKET UNABLE_TO_CLOSE_CHANGE_TICKET|Unable to close change ticket in TM:  Schedule ID: {0} : changeid: {1} :  Reason: {2}|No resolution needed|No action is required\r
-CANNOT_CANCEL_IN_PROGRESS CANNOT_CANCEL_IN_PROGRESS|Cannot delete/cancel a schedule with events in progress.|No resolution needed|No action is required\r
-UNABLE_TO_PARSE_SCHEDULING_INFO UNABLE_TO_PARSE_SCHEDULING_INFO|Cannot parse scheduling info.|No resolution needed|No action is required\r
-UNABLE_TO_LOCATE_CHANGE_RECORD UNABLE_TO_LOCATE_CHANGE_RECORD|Unable to locate TM change record {2} to check status before displacth of {1} for schedulId={0}|No resolution needed|No action is required\r
-INVALID_CHANGE_WINDOW INVALID_CHANGE_WINDOW|Change window end time {1} must be after start time {0}|No resolution needed|No action is required\r
-NODE_LIST_CONTAINS_EMTPY_NODE NODE_LIST_CONTAINS_EMTPY_NODE|vnfDetails node list contains at least one empty node.|No resolution needed|No action is required\r
-SO_API SO_API|SO Poll Request {0}|No resolution needed|No action is required\r
-EXPECTED_EXCEPTION EXPECTED_EXCEPTION|Expected exception encountered during processing. Make Sonar happy: {0}|No resolution needed|No action is required\r
-TM_UPDATE_CHANGE_RECORD TM_UPDATE_CHANGE_RECORD|TM Update Change Record:{0} : Schedule ID: {1} : Change Id : {2} : URL : {3}|No resolution needed|No action is required\r
-UNABLE_TO_UPDATE_CHANGE_TICKET UNABLE_TO_UPDATE_CHANGE_TICKET|Unable to update change ticket in TM: Schedule ID: {0} : changeid: {1} :  Reason: {2}|No resolution needed|No action is required\r
+# Generated from org.onap.optf.cmso.common.LogMessages
+SEARCH_SCHEDULE_REQUEST_DETAILS SEARCH_SCHEDULE_REQUEST_DETAILS|Search Schedule Request Details {0} from {1}: {2}|No resolution needed|No action is required
+SEARCH_SCHEDULE_REQUEST SEARCH_SCHEDULE_REQUEST|Search Schedule Request {0} from {1}: {2} : {3}|No resolution needed|No action is required
+CREATE_SCHEDULE_REQUEST CREATE_SCHEDULE_REQUEST|Create Schedule Request {0} from {1}: {2} : {3}|No resolution needed|No action is required
+DELETE_SCHEDULE_REQUEST DELETE_SCHEDULE_REQUEST|Delete Schedule Request {0} from {1}: {2} : {3}|No resolution needed|No action is required
+GET_SCHEDULE_REQUEST_INFO GET_SCHEDULE_REQUEST_INFO|Get Schedule Request Info {0} from {1}: {2} : {3}|No resolution needed|No action is required
+PROCESS_OPTIMIZER_CALLBACK PROCESS_OPTIMIZER_CALLBACK|Change management optimizer callback {0} from {1}: {2} |No resolution needed|No action is required
+APPROVE_SCHEDULE_REQUEST APPROVE_SCHEDULE_REQUEST|Approve Schedule Request {0} from {1}: {2} : {3}|No resolution needed|No action is required
+SCHEDULE_ALREADY_EXISTS SCHEDULE_ALREADY_EXISTS|Schedule already exists domain={0} schedule id={1}|No resolution needed|No action is required
+SCHEDULE_NOT_FOUND SCHEDULE_NOT_FOUND|Schedule not found domain={0} schedule id={1}|No resolution needed|No action is required
+INVALID_ATTRIBUTE INVALID_ATTRIBUTE|Invalid attribute {0}={1}|No resolution needed|No action is required
+MISSING_REQUIRED_ATTRIBUTE MISSING_REQUIRED_ATTRIBUTE|Missing required attribute '{0}'|No resolution needed|No action is required
+INVALID_REQUEST INVALID_REQUEST|The input data structure is incorrect|No resolution needed|No action is required
+REQUEST_TIMED_OUT REQUEST_TIMED_OUT|Request timed out.|No resolution needed|No action is required
+UNEXPECTED_EXCEPTION UNEXPECTED_EXCEPTION|Unexpected exception encountered during processing. Please contact support : {0}|No resolution needed|No action is required
+UNDEFINED_DOMAIN_DATA_ATTRIBUTE UNDEFINED_DOMAIN_DATA_ATTRIBUTE|Domain data attribute not defined domain={0} name={1} value={2}|No resolution needed|No action is required
+UNDEFINED_FILTER_ATTRIBUTE UNDEFINED_FILTER_ATTRIBUTE|Undefined filter attribute {0}|No resolution needed|No action is required
+INVALID_DATE_FILTER INVALID_DATE_FILTER|Invalid date filter provided {0}=(1}|No resolution needed|No action is required
+OPTIMIZER_QUARTZ_JOB OPTIMIZER_QUARTZ_JOB|Quartz scheduling of OptimizerQuartzJob: {0}|No resolution needed|No action is required
+OPTIMIZER_EXCEPTION OPTIMIZER_EXCEPTION|Exception making client call to optimizer {0}|No resolution needed|No action is required
+OPTIMIZER_CALLBACK_STATE_ERROR OPTIMIZER_CALLBACK_STATE_ERROR|Optimizer callback on schedule in invalid state. Should be {0} but was {1}.|No resolution needed|No action is required
+CHANGE_MANAGEMENT_GROUP_NOT_FOUND CHANGE_MANAGEMENT_GROUP_NOT_FOUND|ChangeManagementGroup not found on optimizer callback scheduleId={0} groupId={1}|No resolution needed|No action is required
+INCOMING_MESSAGE INCOMING_MESSAGE|Incoming message method={0} path={1}|No resolution needed|No action is required
+INCOMING_MESSAGE_RESPONSE INCOMING_MESSAGE_RESPONSE|Message response method={0} path={1} status={2}|No resolution needed|No action is required
+OUTGOING_MESSAGE OUTGOING_MESSAGE|Outgoing message method={0} path={1}|No resolution needed|No action is required
+OUTGOING_MESSAGE_RETURNED OUTGOING_MESSAGE_RETURNED|Outgoing message returned method={0} path={1} status={2}|No resolution needed|No action is required
+UNABLE_TO_ALLOCATE_VNF_TIMESLOTS UNABLE_TO_ALLOCATE_VNF_TIMESLOTS|Unable to allocate VNF timeslots with Optimizer results startTime={0}, latestStartTime={1}, totalDuration={2}, concurrency={3} nvfs={4}|No resolution needed|No action is required
+UNABLE_TO_LOCATE_SCHEDULE_DETAIL UNABLE_TO_LOCATE_SCHEDULE_DETAIL|Unable to locate ChangeManagementSchedule for VNF. scheduleId={0}, groupId={1}, vnfName={2}|No resolution needed|No action is required
+CM_JOB CM_JOB|Quartz scheduling of CmJob: {0}|No resolution needed|No action is required
+CM_QUARTZ_JOB CM_QUARTZ_JOB|Quartz scheduling of CmQuartzJob: {0}|No resolution needed|No action is required
+NOT_PENDING_APPROVAL NOT_PENDING_APPROVAL|Approval request received for schedule that is not in Pending Approval state: domain={0} scheduleId={1} state={3}|No resolution needed|No action is required
+SCHEDULE_PAST_DUE SCHEDULE_PAST_DUE|Attempt to dispatch an event that is Past due scheduleId={0}, vnf={1}, now={2}, startTime={3}|No resolution needed|No action is required
+MSO_POLLING_MISSING_SCHEDULE MSO_POLLING_MISSING_SCHEDULE|Attempt to poll MSO for request id {1} for missing ChangeManagementSchedule id={0}|No resolution needed|No action is required
+MSO_STATUS_JOB MSO_STATUS_JOB|Polling MSO {0} for requestId={1} for id={2}|No resolution needed|No action is required
+UNEXPECTED_RESPONSE UNEXPECTED_RESPONSE|Unexpected response from {0} HTTP Status={1} : {2}|No resolution needed|No action is required
+SCHEDULE_STATUS_JOB SCHEDULE_STATUS_JOB|Quartz scheduling of ScheduleStatusJob: {0}|No resolution needed|No action is required
+CM_TICKET_NOT_APPROVED CM_TICKET_NOT_APPROVED|Attempt to dispatch a change management event that has no TM Ticket approved. scheduleId={0} VNF Name={1} TM ChangeId={2} Status={3} Approval Status={4}|No resolution needed|No action is required
+MULTIPLE_GROUPS_NOT_SUPPORTED MULTIPLE_GROUPS_NOT_SUPPORTED|Multiple groups not supported on immediate requests|No resolution needed|No action is required
+TM_CREATE_CHANGE_RECORD TM_CREATE_CHANGE_RECORD|TM Create Change Record:{0} : Schedule ID: {1}|No resolution needed|No action is required
+TM_LIST TM_LIST|TM list:{0} : URL : {1}|No resolution needed|No action is required
+TM_API TM_API|TM API Call: URL : {0}|No resolution needed|No action is required
+UNABLE_TO_CREATE_CHANGE_TICKET UNABLE_TO_CREATE_CHANGE_TICKET|Unable to create change ticket in TM: Schedule ID: {0} : Reason : {1}|No resolution needed|No action is required
+TM_UPDATE_CHECKLIST TM_UPDATE_CHECKLIST|TM Fetch Checklist:{0} : Schedule ID: {1} : Change Id : {2} : URL : {3}|No resolution needed|No action is required
+OPTIMIZER_REQUEST OPTIMIZER_REQUEST|Optimi Request:{0} : Schedule ID: {1} : URL : {2}|No resolution needed|No action is required
+TM_CLOSE_CHANGE_RECORD TM_CLOSE_CHANGE_RECORD|TM Close Change Record:{0} : Schedule ID: {1} : Change Id : {2}|No resolution needed|No action is required
+UNABLE_TO_CLOSE_CHANGE_TICKET UNABLE_TO_CLOSE_CHANGE_TICKET|Unable to close change ticket in TM:  Schedule ID: {0} : changeid: {1} :  Reason: {2}|No resolution needed|No action is required
+CANNOT_CANCEL_IN_PROGRESS CANNOT_CANCEL_IN_PROGRESS|Cannot delete/cancel a schedule with events in progress.|No resolution needed|No action is required
+UNABLE_TO_PARSE_SCHEDULING_INFO UNABLE_TO_PARSE_SCHEDULING_INFO|Cannot parse scheduling info.|No resolution needed|No action is required
+UNABLE_TO_LOCATE_CHANGE_RECORD UNABLE_TO_LOCATE_CHANGE_RECORD|Unable to locate TM change record {2} to check status before displacth of {1} for schedulId={0}|No resolution needed|No action is required
+INVALID_CHANGE_WINDOW INVALID_CHANGE_WINDOW|Change window end time {1} must be after start time {0}|No resolution needed|No action is required
+NODE_LIST_CONTAINS_EMTPY_NODE NODE_LIST_CONTAINS_EMTPY_NODE|vnfDetails node list contains at least one empty node.|No resolution needed|No action is required
+SO_API SO_API|SO Poll Request {0}|No resolution needed|No action is required
+EXPECTED_EXCEPTION EXPECTED_EXCEPTION|Expected exception encountered during processing. {0}|No resolution needed|No action is required
+TM_UPDATE_CHANGE_RECORD TM_UPDATE_CHANGE_RECORD|TM Update Change Record:{0} : Schedule ID: {1} : Change Id : {2} : URL : {3}|No resolution needed|No action is required
+UNABLE_TO_UPDATE_CHANGE_TICKET UNABLE_TO_UPDATE_CHANGE_TICKET|Unable to update change ticket in TM: Schedule ID: {0} : changeid: {1} :  Reason: {2}|No resolution needed|No action is required
+UNAUTHORIZED UNAUTHORIZED|Authorization failed.|No resolution needed|No action is required
+UNAUTHENTICATED UNAUTHENTICATED|Authentication failed.|No resolution needed|No action is required
+UNRECOGNIZED_MSO_STATUS UNRECOGNIZED_MSO_STATUS|Unrecognized status returned by MSO {0}|No resolution needed|No action is required
+UNABLE_TO_PARSE_MSO_RESPONSE UNABLE_TO_PARSE_MSO_RESPONSE|Unable to parse status message from MSO {0} : {1}|No resolution needed|No action is required