Fixed healtcheck and status check execution 68/124468/1
authorLukasz Rajewski <lukasz.rajewski@orange.com>
Fri, 24 Sep 2021 08:47:25 +0000 (10:47 +0200)
committerLukasz Rajewski <lukasz.rajewski@orange.com>
Fri, 24 Sep 2021 08:49:03 +0000 (10:49 +0200)
Also added missing licence info.

Issue-ID: SO-3768
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com>
Change-Id: I0f39e6ca0e8666ac211d46228409e9c7afb3e9f9

29 files changed:
so-cnf-adapter-application/pom.xml
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/AaiConfiguration.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/MulticloudConfiguration.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/aai/AaiCallbackResponse.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckInstance.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckInstanceResponse.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckResponse.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/K8sRbInstanceHealthCheck.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/K8sRbInstanceHealthCheckSimple.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sOwnerReference.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceGvk.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceResourceStatus.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceStatus.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sStatus.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sStatusMetadata.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/StatusCheckInstanceResponse.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/StatusCheckResponse.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiIdGeneratorService.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiResponseParser.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiService.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/KubernetesResource.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/healthcheck/HealthCheckService.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/statuscheck/SimpleStatusCheckService.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/util/AaiRepository.java
so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/util/IAaiRepository.java
so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java
so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java

index 46099e8..0daa32c 100755 (executable)
@@ -99,7 +99,7 @@
             <dependency>
                 <groupId>org.onap.aai.schema-service</groupId>
                 <artifactId>aai-schema</artifactId>
-                <version>1.9.1</version>
+                <version>1.9.2</version>
             </dependency>
         </dependencies>
   </dependencyManagement>
index 49f95a6..3845bf4 100644 (file)
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. 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.so.adapters.cnf;
 
 import org.springframework.beans.factory.annotation.Value;
index 0890739..5eb5e6f 100644 (file)
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. 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.so.adapters.cnf;
 
 import org.springframework.beans.factory.annotation.Value;
index b6ebbb3..d72d1f9 100644 (file)
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. 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.so.adapters.cnf.model.aai;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
index df87768..841db97 100644 (file)
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. 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.so.adapters.cnf.model.healthcheck;
 
 public class HealthCheckInstance {
index 7811fe1..e71d4ba 100644 (file)
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. 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.so.adapters.cnf.model.healthcheck;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
index 2d0bb88..1bc6253 100644 (file)
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Orange.
+ * ================================================================================
+ * 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.so.adapters.cnf.model.healthcheck;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@@ -11,32 +32,19 @@ import java.util.List;
 public class HealthCheckResponse {
 
     @JsonProperty("result")
-    private List<HealthCheckInstanceResponse> instanceResponse;
-
-    @JsonProperty("error")
-    private String errorMessage;
+    private List<HealthCheckInstanceResponse> result;
 
     public List<HealthCheckInstanceResponse> getInstanceResponse() {
-        return instanceResponse;
-    }
-
-    public void setInstanceResponse(List<HealthCheckInstanceResponse> instanceResponse) {
-        this.instanceResponse = instanceResponse;
-    }
-
-    public String getErrorMessage() {
-        return errorMessage;
+        return result;
     }
 
-    public void setErrorMessage(String errorMessage) {
-        this.errorMessage = errorMessage;
+    public void setInstanceResponse(List<HealthCheckInstanceResponse> result) {
+        this.result = result;
     }
 
     @Override
     public String toString() {
         return "HealthCheckResponse{" +
-                "instanceResponse=" + instanceResponse +
-                ", errorMessage='" + errorMessage + '\'' +
-                '}';
+                "result=" + result + '}';
     }
 }
index bab6a5a..21e58ee 100644 (file)
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Orange.
+ * ================================================================================
+ * 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.so.adapters.cnf.model.healthcheck;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@@ -5,9 +26,15 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 @JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonIgnoreProperties(value = "true")
+@JsonIgnoreProperties(ignoreUnknown = true)
 public class K8sRbInstanceHealthCheck {
 
+    @JsonProperty("instance-id")
+    private String instanceId;
+
+    @JsonProperty("healthcheck-id")
+    private String healthcheckId;
+
     @JsonProperty("status")
     private String status;
 
@@ -19,6 +46,22 @@ public class K8sRbInstanceHealthCheck {
         this.status = status;
     }
 
+    public String getInstanceId() {
+        return instanceId;
+    }
+
+    public void setInstanceId(String instanceId) {
+        this.instanceId = instanceId;
+    }
+
+    public String getHealthcheckId() {
+        return healthcheckId;
+    }
+
+    public void setHealthcheckId(String healthcheckId) {
+        this.healthcheckId = healthcheckId;
+    }
+
     @Override
     public String toString() {
         return "K8sRbInstanceHealthCheck{" +
index 8a2590d..474510d 100644 (file)
@@ -1,7 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Orange.
+ * ================================================================================
+ * 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.so.adapters.cnf.model.healthcheck;
 
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(value = "true")
 public class K8sRbInstanceHealthCheckSimple {
 
     @JsonProperty("healthcheck-id")
index c350ebd..47ba8c3 100644 (file)
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Orange. 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.so.adapters.cnf.model.statuscheck;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
index e50bbaa..33f3c74 100644 (file)
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. 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.so.adapters.cnf.model.statuscheck;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
index ff6465d..a125e40 100644 (file)
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. 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.so.adapters.cnf.model.statuscheck;
 
 
index ae9b2cd..a8ab468 100644 (file)
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. 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.so.adapters.cnf.model.statuscheck;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
index 1c910d9..796e5f3 100644 (file)
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Orange.
+ * ================================================================================
+ * 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.so.adapters.cnf.model.statuscheck;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
index 041b811..b3efafb 100644 (file)
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Orange.
+ * ================================================================================
+ * 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.so.adapters.cnf.model.statuscheck;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
index fe3e2cc..e605fbe 100644 (file)
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. 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.so.adapters.cnf.model.statuscheck;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
index 33f1847..f1eada3 100644 (file)
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Orange.
+ * ================================================================================
+ * 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.so.adapters.cnf.model.statuscheck;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@@ -11,32 +32,20 @@ import java.util.List;
 public class StatusCheckResponse {
 
     @JsonProperty("result")
-    private List<StatusCheckInstanceResponse> instanceResponse;
-
-    @JsonProperty("error")
-    private String errorMessage;
+    private List<StatusCheckInstanceResponse> result;
 
     public List<StatusCheckInstanceResponse> getInstanceResponse() {
-        return instanceResponse;
-    }
-
-    public void setInstanceResponse(List<StatusCheckInstanceResponse> instanceResponse) {
-        this.instanceResponse = instanceResponse;
-    }
-
-    public String getErrorMessage() {
-        return errorMessage;
+        return result;
     }
 
-    public void setErrorMessage(String errorMessage) {
-        this.errorMessage = errorMessage;
+    public void setInstanceResponse(List<StatusCheckInstanceResponse> result) {
+        this.result = result;
     }
 
     @Override
     public String toString() {
         return "StatusCheckResponse{" +
-                "instanceResponse=" + instanceResponse +
-                ", errorMessage='" + errorMessage + '\'' +
+                "result=" + result +
                 '}';
     }
 }
index 11dff5d..a68ef67 100644 (file)
@@ -3,6 +3,8 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Samsung Technologies Co.
+ * Modifications Copyright (C) 2021 Orange.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -54,6 +56,7 @@ import org.onap.so.adapters.cnf.model.instantiation.AaiRequest;
 import org.onap.so.adapters.cnf.model.statuscheck.StatusCheckResponse;
 import org.onap.so.adapters.cnf.service.CnfAdapterService;
 import org.onap.so.adapters.cnf.service.aai.AaiService;
+import org.onap.so.adapters.cnf.service.healthcheck.HealthCheckService;
 import org.onap.so.adapters.cnf.service.statuscheck.SimpleStatusCheckService;
 import org.onap.so.client.exception.BadResponseException;
 import org.slf4j.Logger;
@@ -81,6 +84,7 @@ public class CnfAdapterRest {
     private static final Logger logger = LoggerFactory.getLogger(CnfAdapterRest.class);
     private final CloseableHttpClient httpClient = HttpClients.createDefault();
     private final SimpleStatusCheckService simpleStatusCheckService;
+    private final HealthCheckService healthCheckService;
     private final CnfAdapterService cnfAdapterService;
     private final SoCallbackClient callbackClient;
     private final AaiService aaiService;
@@ -88,11 +92,13 @@ public class CnfAdapterRest {
 
     @Autowired
     public CnfAdapterRest(SimpleStatusCheckService simpleStatusCheckService,
+                          HealthCheckService healthCheckService,
                           CnfAdapterService cnfAdapterService,
                           SoCallbackClient callbackClient,
                           AaiService aaiService,
                           MulticloudConfiguration multicloudConfiguration) {
         this.simpleStatusCheckService = simpleStatusCheckService;
+        this.healthCheckService = healthCheckService;
         this.cnfAdapterService = cnfAdapterService;
         this.aaiService = aaiService;
         this.callbackClient = callbackClient;
@@ -107,15 +113,14 @@ public class CnfAdapterRest {
         DeferredResult<ResponseEntity> response = new DeferredResult<>();
 
         new Thread(() -> {
-            logger.info("Processing healthCheck service");
+            logger.info("Processing health check request");
+
             HealthCheckResponse healthCheckResponse = null;
             try {
-                healthCheckResponse = cnfAdapterService.healthCheck(healthCheckRequest);
+                healthCheckResponse = healthCheckService.healthCheck(healthCheckRequest);
             } catch (Exception e) {
-                HealthCheckResponse errorHealthCheck = new HealthCheckResponse();
-                errorHealthCheck.setErrorMessage(e.getMessage());
-                callbackClient.sendPostCallback(healthCheckRequest.getCallbackUrl(), errorHealthCheck);
-                return;
+                logger.error("END - Health check process failed", e);
+                healthCheckResponse = healthCheckService.healthCheckError(healthCheckRequest, e);
             }
             callbackClient.sendPostCallback(healthCheckRequest.getCallbackUrl(), healthCheckResponse);
         }).start();
@@ -182,15 +187,13 @@ public class CnfAdapterRest {
         DeferredResult<ResponseEntity> response = new DeferredResult<>();
 
         new Thread(() -> {
-            logger.info("Processing healthCheck service");
+            logger.info("Processing status check request");
             StatusCheckResponse statusCheckResponse = null;
             try {
                 statusCheckResponse = simpleStatusCheckService.statusCheck(statusCheckRequest);
-            } catch (BadResponseException e) {
-                StatusCheckResponse errorStatusCheck = new StatusCheckResponse();
-                errorStatusCheck.setErrorMessage(e.getMessage());
-                callbackClient.sendPostCallback(statusCheckRequest.getCallbackUrl(), e);
-                return;
+            } catch (Exception e) {
+                logger.error("END - Status check process failed", e);
+                statusCheckResponse = simpleStatusCheckService.statusCheckError(statusCheckRequest, e);
             }
             callbackClient.sendPostCallback(statusCheckRequest.getCallbackUrl(), statusCheckResponse);
         }).start();
index 12aa4ad..7e667a0 100644 (file)
@@ -3,6 +3,8 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Samsung Technologies Co.
+ * Modifications Copyright (C) 2021 Orange.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -55,26 +57,15 @@ public class CnfAdapterService {
     private static final String INSTANCE_CREATE_PATH = "/v1/instance";
 
     private final RestTemplate restTemplate;
-    private final HealthCheckService healthCheckService;
-    private final SimpleStatusCheckService simpleStatusCheckService;
     private final String uri;
 
     @Autowired
     public CnfAdapterService(RestTemplate restTemplate,
-                             HealthCheckService healthCheckService,
-                             SimpleStatusCheckService simpleStatusCheckService,
                              MulticloudConfiguration multicloudConfiguration) {
         this.restTemplate = restTemplate;
-        this.healthCheckService = healthCheckService;
-        this.simpleStatusCheckService = simpleStatusCheckService;
         this.uri = multicloudConfiguration.getMulticloudUrl();
     }
 
-    public HealthCheckResponse healthCheck(CheckInstanceRequest healthCheckRequest) throws Exception {
-        logger.info("CnfAdapterService healthCheck called");
-        return healthCheckService.healthCheck(healthCheckRequest);
-    }
-
     public String createInstance(BpmnInstanceRequest bpmnInstanceRequest)
             throws JsonParseException, JsonMappingException, IOException {
         try {
index 9c62031..f8e24f9 100644 (file)
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Orange.
+ * ================================================================================
+ * 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.so.adapters.cnf.service.aai;
 
 import com.google.common.hash.Hashing;
index 9797934..ee6fd51 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Orange.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
  * ============LICENSE_END=========================================================
  */
 
+
 package org.onap.so.adapters.cnf.service.aai;
 
 import org.apache.http.client.utils.URIBuilder;
index 2225e81..db8998e 100644 (file)
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Orange.
+ * ================================================================================
+ * 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.so.adapters.cnf.service.aai;
 
 import org.onap.so.adapters.cnf.AaiConfiguration;
index 7dd8f7a..98296a3 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Orange.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 2f91be8..024ff1c 100644 (file)
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Orange.
+ * ================================================================================
+ * 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.so.adapters.cnf.service.healthcheck;
 
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
@@ -47,6 +68,20 @@ public class HealthCheckService {
         return statuses;
     }
 
+    public HealthCheckResponse healthCheckError(CheckInstanceRequest healthCheckRequest, Exception e) {
+        HealthCheckResponse result = new HealthCheckResponse();
+
+        List<HealthCheckInstanceResponse> instanceHealthCheckList = new ArrayList<>();
+        for (InstanceRequest instanceRequest : healthCheckRequest.getInstances()) {
+            HealthCheckInstanceResponse healthCheck = new HealthCheckInstanceResponse(
+                    instanceRequest.getInstanceId(), e.getMessage(), "Failed");
+            instanceHealthCheckList.add(healthCheck);
+        }
+
+        result.setInstanceResponse(instanceHealthCheckList);
+        return result;
+    }
+
     private List<HealthCheckInstance> startInstanceHealthCheck(CheckInstanceRequest healthCheckRequest) throws Exception {
         log.debug("startInstanceHealthCheck - START");
         List<HealthCheckInstance> healthCheckInstanceList = new ArrayList<>();
@@ -80,8 +115,7 @@ public class HealthCheckService {
                     InstanceStatusTuple instanceStatusTuple = future.get();
                     String instanceId = instanceStatusTuple.getInstanceId();
                     String status = instanceStatusTuple.getStatus();
-                    String reason = null;
-                    return new HealthCheckInstanceResponse(instanceId, reason, status);
+                    return new HealthCheckInstanceResponse(instanceId, null, status);
                 } catch (Exception e) {
                     throw new RuntimeException(e);
                 }
@@ -122,7 +156,9 @@ public class HealthCheckService {
                 }
                 sleep(10_000L);
             }
-            return new InstanceStatusTuple(healthCheckInstance.getInstanceId(), "Timeout");
+            //Timeout
+            instanceApi.deleteInstanceHealthCheck(healthCheckInstance.getInstanceId(), healthCheckInstance.getHealthCheckInstance());
+            return new InstanceStatusTuple(healthCheckInstance.getInstanceId(), "Unknown");
         }
     }
 
index 510d6b8..7e750a9 100644 (file)
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Orange.
+ * ================================================================================
+ * 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.so.adapters.cnf.service.statuscheck;
 
 import org.onap.so.adapters.cnf.client.MulticloudClient;
@@ -41,6 +62,20 @@ public class SimpleStatusCheckService {
         return result;
     }
 
+    public StatusCheckResponse statusCheckError(CheckInstanceRequest instanceIds, Exception e) {
+        StatusCheckResponse result = new StatusCheckResponse();
+
+        List<StatusCheckInstanceResponse> simpleStatuses = new ArrayList<>();
+        for (InstanceRequest instanceRequest : instanceIds.getInstances()) {
+            StatusCheckInstanceResponse statusCheck = new StatusCheckInstanceResponse(
+                    instanceRequest.getInstanceId(), e.getMessage(), false);
+            simpleStatuses.add(statusCheck);
+        }
+
+        result.setInstanceResponse(simpleStatuses);
+        return result;
+    }
+
     private StatusCheckInstanceResponse getStatusCheck(String instanceId) throws BadResponseException {
         log.debug("SIMPLE STATUS CHECK - START");
         K8sRbInstanceStatus instanceStatus = instanceApi.getInstanceStatus(instanceId);
index ed532da..2ca9e3a 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Orange.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.so.adapters.cnf.util;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
index e9b15c5..9bdf1b7 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP - SO
  * ================================================================================
  * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 Orange.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.so.adapters.cnf.util;
 
 import org.onap.so.adapters.cnf.model.instantiation.AaiRequest;
index e5c50c4..e188a64 100644 (file)
@@ -77,20 +77,6 @@ public class CnfAdapterRestTest {
     @Mock
     ResponseEntity<InstanceStatusResponse> instanceStatusResponse;
 
-    @Test
-    public void healthCheckTest() throws Exception {
-        HealthCheckResponse response = new HealthCheckResponse();
-        DeferredResult<HealthCheckResponse> deferredResponse = new DeferredResult<>();
-        deferredResponse.setResult(response);
-        CnfAdapterService cnfAdapterService = Mockito.mock(CnfAdapterService.class);
-        CheckInstanceRequest healthCheckRequest = Mockito.mock(CheckInstanceRequest.class);
-        Mockito.when(cnfAdapterService.healthCheck(healthCheckRequest)).thenReturn(response);
-
-        cnfAdapterRest.healthCheck(healthCheckRequest);
-
-        Assert.assertNotNull(response);
-    }
-
     @Test
     public void createInstanceTest() throws Exception {
 
index 7d161bc..12c0511 100644 (file)
@@ -69,7 +69,7 @@ public class CnfAdapterServiceTest {
     public void setUp() {
         MulticloudConfiguration multicloudConfiguration = mock(MulticloudConfiguration.class);
         doReturn("http://test.url").when(multicloudConfiguration).getMulticloudUrl();
-        cnfAdapterService = spy(new CnfAdapterService(restTemplate, healthCheckService, simpleStatusCheckService, multicloudConfiguration));
+        cnfAdapterService = spy(new CnfAdapterService(restTemplate, multicloudConfiguration));
     }