summaryrefslogtreecommitdiffstats
path: root/so-cnf-adapter-application/src
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2021-09-24 10:47:25 +0200
committerLukasz Rajewski <lukasz.rajewski@orange.com>2021-09-24 10:49:03 +0200
commit4a99130f41da7344c6cc608eff83baa688e5cafc (patch)
treec84bd1bec14cef3588b4311a63286c3155acc3af /so-cnf-adapter-application/src
parent7daa22b6becb9a65a31ab8e17beff68227f12b50 (diff)
Fixed healtcheck and status check execution
Also added missing licence info. Issue-ID: SO-3768 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com> Change-Id: I0f39e6ca0e8666ac211d46228409e9c7afb3e9f9
Diffstat (limited to 'so-cnf-adapter-application/src')
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/AaiConfiguration.java20
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/MulticloudConfiguration.java20
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/aai/AaiCallbackResponse.java20
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckInstance.java20
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckInstanceResponse.java20
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckResponse.java44
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/K8sRbInstanceHealthCheck.java45
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/K8sRbInstanceHealthCheckSimple.java25
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sOwnerReference.java20
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceGvk.java20
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceResourceStatus.java20
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceStatus.java20
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sStatus.java21
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sStatusMetadata.java21
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/StatusCheckInstanceResponse.java20
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/StatusCheckResponse.java43
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java27
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java13
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiIdGeneratorService.java21
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiResponseParser.java2
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiService.java21
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/KubernetesResource.java1
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/healthcheck/HealthCheckService.java42
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/statuscheck/SimpleStatusCheckService.java35
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/util/AaiRepository.java2
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/util/IAaiRepository.java2
-rw-r--r--so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java14
-rw-r--r--so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java2
28 files changed, 504 insertions, 77 deletions
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/AaiConfiguration.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/AaiConfiguration.java
index 49f95a6..3845bf4 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/AaiConfiguration.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/AaiConfiguration.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/MulticloudConfiguration.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/MulticloudConfiguration.java
index 0890739..5eb5e6f 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/MulticloudConfiguration.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/MulticloudConfiguration.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/aai/AaiCallbackResponse.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/aai/AaiCallbackResponse.java
index b6ebbb3..d72d1f9 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/aai/AaiCallbackResponse.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/aai/AaiCallbackResponse.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckInstance.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckInstance.java
index df87768..841db97 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckInstance.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckInstance.java
@@ -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 {
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckInstanceResponse.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckInstanceResponse.java
index 7811fe1..e71d4ba 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckInstanceResponse.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckInstanceResponse.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckResponse.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckResponse.java
index 2d0bb88..1bc6253 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckResponse.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/HealthCheckResponse.java
@@ -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 + '}';
}
}
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/K8sRbInstanceHealthCheck.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/K8sRbInstanceHealthCheck.java
index bab6a5a..21e58ee 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/K8sRbInstanceHealthCheck.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/K8sRbInstanceHealthCheck.java
@@ -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{" +
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/K8sRbInstanceHealthCheckSimple.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/K8sRbInstanceHealthCheckSimple.java
index 8a2590d..474510d 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/K8sRbInstanceHealthCheckSimple.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/healthcheck/K8sRbInstanceHealthCheckSimple.java
@@ -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")
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sOwnerReference.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sOwnerReference.java
index c350ebd..47ba8c3 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sOwnerReference.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sOwnerReference.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceGvk.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceGvk.java
index e50bbaa..33f3c74 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceGvk.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceGvk.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceResourceStatus.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceResourceStatus.java
index ff6465d..a125e40 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceResourceStatus.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceResourceStatus.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceStatus.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceStatus.java
index ae9b2cd..a8ab468 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceStatus.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sRbInstanceStatus.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sStatus.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sStatus.java
index 1c910d9..796e5f3 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sStatus.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sStatus.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sStatusMetadata.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sStatusMetadata.java
index 041b811..b3efafb 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sStatusMetadata.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/K8sStatusMetadata.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/StatusCheckInstanceResponse.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/StatusCheckInstanceResponse.java
index fe3e2cc..e605fbe 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/StatusCheckInstanceResponse.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/StatusCheckInstanceResponse.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/StatusCheckResponse.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/StatusCheckResponse.java
index 33f1847..f1eada3 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/StatusCheckResponse.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/statuscheck/StatusCheckResponse.java
@@ -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 +
'}';
}
}
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java
index 11dff5d..a68ef67 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java
@@ -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();
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java
index 12aa4ad..7e667a0 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java
@@ -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 {
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiIdGeneratorService.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiIdGeneratorService.java
index 9c62031..f8e24f9 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiIdGeneratorService.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiIdGeneratorService.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiResponseParser.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiResponseParser.java
index 9797934..ee6fd51 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiResponseParser.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiResponseParser.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiService.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiService.java
index 2225e81..db8998e 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiService.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/AaiService.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/KubernetesResource.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/KubernetesResource.java
index 7dd8f7a..98296a3 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/KubernetesResource.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/aai/KubernetesResource.java
@@ -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.
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/healthcheck/HealthCheckService.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/healthcheck/HealthCheckService.java
index 2f91be8..024ff1c 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/healthcheck/HealthCheckService.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/healthcheck/HealthCheckService.java
@@ -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");
}
}
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/statuscheck/SimpleStatusCheckService.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/statuscheck/SimpleStatusCheckService.java
index 510d6b8..7e750a9 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/statuscheck/SimpleStatusCheckService.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/statuscheck/SimpleStatusCheckService.java
@@ -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);
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/util/AaiRepository.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/util/AaiRepository.java
index ed532da..2ca9e3a 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/util/AaiRepository.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/util/AaiRepository.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/util/IAaiRepository.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/util/IAaiRepository.java
index e9b15c5..9bdf1b7 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/util/IAaiRepository.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/util/IAaiRepository.java
@@ -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;
diff --git a/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java b/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java
index e5c50c4..e188a64 100644
--- a/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java
+++ b/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java
@@ -78,20 +78,6 @@ public class CnfAdapterRestTest {
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 {
Map<String, String> labels = new HashMap<String, String>();
diff --git a/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java b/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java
index 7d161bc..12c0511 100644
--- a/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java
+++ b/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java
@@ -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));
}