+ @Override
+ public ExternalComponentStatus probeComponent() {
+ String url = SystemProperties.getProperty(
+ MsoProperties.MSO_SERVER_URL) + "/" + SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQS);
+ long startTime = System.currentTimeMillis();
+ ExternalComponentStatus externalComponentStatus;
+
+ try {
+ String rawBody = objectMapper.writeValueAsString(getOrchestrationRequestsForDashboard());
+ StatusMetadata statusMetadata=new HttpRequestMetadata(HttpMethod.GET,200,url,rawBody,"VID-SO",System.currentTimeMillis() - startTime);
+
+ externalComponentStatus = new ExternalComponentStatus(ExternalComponentStatus.Component.MSO, true, statusMetadata);
+ } catch (Exception e) {
+ StatusMetadata statusMetadata = new HttpRequestMetadata(HttpMethod.GET, HttpStatus.INTERNAL_SERVER_ERROR.value(), url, "", e.getMessage(), System.currentTimeMillis() - startTime);
+ externalComponentStatus = new ExternalComponentStatus(ExternalComponentStatus.Component.MSO, false, statusMetadata);
+ }
+
+ return externalComponentStatus;
+ }
+
+ private void validateUpdateVnfConfig(RequestDetails requestDetails) {
+ final String noValidPayloadMsg = "No valid payload in " + ChangeManagementRequest.CONFIG_UPDATE + " request";
+
+ Map payload = getChangeManagementPayload(requestDetails, noValidPayloadMsg);
+ validateConfigUpdateVnfPayloadProperty(payload, noValidPayloadMsg, "request-parameters");
+ validateConfigUpdateVnfPayloadProperty(payload, noValidPayloadMsg, "configuration-parameters");
+ }
+
+ private void validateConfigUpdateVnfPayloadProperty(Map payload, String noValidPayloadMsg, String propertyName) {
+ final String noValidPayloadPropertyMsg = noValidPayloadMsg + ", " + propertyName + " property is not valid";
+ if (!payload.containsKey(propertyName)) {
+ throw new BadRequestException(noValidPayloadPropertyMsg);
+ }
+ }
+
+ private void logInvocationInDebug(String methodName) {
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + " start");
+ }
+
+ private void logException(String methodName, Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + e.toString());
+ }
+
+ private boolean isSuccessful(HttpResponse<SOWorkflowList> workflowListByModelId) {
+ int status = workflowListByModelId.getStatus();
+ return HttpStatus.OK.value() == status || HttpStatus.ACCEPTED.value() == status;
+ }
+
+ static class WorkflowListException extends RuntimeException{
+
+ WorkflowListException(String message) {
+ super(message);
+ }
+ }
+
+ public enum RequestType {
+
+ CREATE_INSTANCE("createInstance"),
+ DELETE_INSTANCE("deleteInstance"),
+ REPLACE_INSTANCE("replaceInstance"),
+ UPDATE_INSTANCE("updateInstance"),
+ ACTIVATE_INSTANCE("activateInstance"),
+ DEACTIVATE_INSTANCE("deactivateInstance"),
+ APPLY_UPDATED_CONFIG("applyUpdatedConfig"),
+ IN_PLACE_SOFTWARE_UPDATE("inPlaceSoftwareUpdate"),
+ SCALE_OUT("scaleOut"),
+ UNKNOWN("unknown"),
+ NOT_PROVIDED("not provided");
+ private final String value;
+ private static final Map<String, RequestType> CONSTANTS = new HashMap<>();
+
+ static {
+ for (RequestType c : values()) {
+ CONSTANTS.put(c.value, c);
+ }
+ }
+
+ RequestType(String value) {
+ this.value = value;
+ }
+
+ @JsonCreator
+ public static RequestType fromValue(String value) {
+ RequestType constant = CONSTANTS.get(value);
+ if (constant == null) {
+ throw new IllegalArgumentException(value);
+ } else {
+ return constant;
+ }
+ }
+
+ @JsonValue
+ @Override
+ public String toString() {
+ return this.value;
+ }
+ }
+}