diff options
Diffstat (limited to 'controlloop/common/model-impl/vfc/src')
4 files changed, 18 insertions, 4 deletions
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java index 4797ab906..5cb6d6624 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java @@ -21,6 +21,7 @@ package org.onap.policy.vfc; import java.util.HashMap; import java.util.Map; +import org.drools.core.WorkingMemory; import org.onap.policy.vfc.util.Serialization; import org.onap.policy.rest.RESTManager; import org.onap.policy.rest.RESTManager.Pair; @@ -35,9 +36,11 @@ public final class VFCManager implements Runnable { private String username; private String password; private VFCRequest vfcRequest; + WorkingMemory workingMem; private static final Logger logger = LoggerFactory.getLogger(VFCManager.class); - public VFCManager(VFCRequest request) { + public VFCManager(WorkingMemory wm, VFCRequest request) { + workingMem = wm; vfcRequest = request; // TODO: Get base URL, username and password from MSB? // TODO: Following code is a placeholder, needs to be updated @@ -83,6 +86,7 @@ public final class VFCManager implements Runnable { Pair<Integer, String> httpDetailsGet = RESTManager.get(urlGet, username, password, headers); responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, VFCResponse.class); + responseGet.requestId = vfcRequest.requestId.toString(); body = Serialization.gsonPretty.toJson(responseGet); logger.debug("Response to VFC Heal get:"); logger.debug(body); @@ -91,6 +95,7 @@ public final class VFCManager implements Runnable { if (responseGet.responseDescriptor.status.equalsIgnoreCase("finished") || responseGet.responseDescriptor.status.equalsIgnoreCase("error")) { logger.debug("VFC Heal Status {}", responseGet.responseDescriptor.status); + workingMem.insert(responseGet); break; } } @@ -102,6 +107,7 @@ public final class VFCManager implements Runnable { && (responseGet.responseDescriptor.status != null) && (!responseGet.responseDescriptor.status.isEmpty())) { logger.debug("VFC timeout. Status: ({})", responseGet.responseDescriptor.status); + workingMem.insert(responseGet); } } catch (JsonSyntaxException e) { logger.error("Failed to deserialize into VFCResponse {}",e.getLocalizedMessage(),e); diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java index 9e3a77a2b..89c9b08ff 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java @@ -19,14 +19,16 @@ package org.onap.policy.vfc; import java.io.Serializable; +import java.util.UUID; import com.google.gson.annotations.SerializedName; public class VFCRequest implements Serializable { private static final long serialVersionUID = 3736300970326332512L; - // This field is not serialized and not part of JSON + // These fields are not serialized and not part of JSON public transient String nsInstanceId; + public transient UUID requestId; @SerializedName("healVnfData") public VFCHealRequest healRequest; diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java index 775d78f1d..5d6efa0ce 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java @@ -30,7 +30,9 @@ public class VFCResponse implements Serializable { public String jobId; @SerializedName("responseDescriptor") - VFCResponseDescriptor responseDescriptor; + public VFCResponseDescriptor responseDescriptor; + + public transient String requestId; public VFCResponse() { } diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java index 9bf77c57c..62c61a7f6 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java @@ -27,7 +27,7 @@ public class VFCResponseDescriptor implements Serializable { private static final long serialVersionUID = 6827782899144150158L; @SerializedName("progress") - public String progress; + String progress; @SerializedName("status") String status; @@ -47,4 +47,8 @@ public class VFCResponseDescriptor implements Serializable { public VFCResponseDescriptor() { } + public String getStatus() { + return status; + } + } |