aboutsummaryrefslogtreecommitdiffstats
path: root/cmso-service/src
diff options
context:
space:
mode:
Diffstat (limited to 'cmso-service/src')
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java7
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java13
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispacherService.java13
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java18
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java10
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/eventq/DispatchedEventList.java16
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java24
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java49
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java39
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java48
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java46
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java28
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/HelloWorld.java58
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java32
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java52
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java163
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleQuery.java23
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java10
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDAO.java18
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java20
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDAO.java18
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java27
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java10
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDAO.java10
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDAO.java15
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleEventDAO.java53
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAOImpl.java18
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CMSOptimizerClient.java78
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java5
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMOptimizerResponse.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminTool.java13
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java16
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java27
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizedScheduleService.java74
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizedScheduleServiceImpl.java122
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizerCallbackImpl.java (renamed from cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSCallbackImpl.java)529
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOService.java6
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOServiceImpl.java59
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOptimizerCallback.java14
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java342
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheck.java15
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java13
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/ChangeWindow.java87
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/ElementInfo.java93
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/NameValue.java98
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/OptimizedScheduleMessage.java132
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/PolicyInfo.java82
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/SchedulingData.java132
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java6
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java11
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java15
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java10
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmStatusClient.java17
54 files changed, 1757 insertions, 1085 deletions
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java b/cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java
index 9b10d51..9189326 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/JerseyConfiguration.java
@@ -42,7 +42,7 @@ import org.glassfish.jersey.servlet.ServletProperties;
import org.onap.optf.cmso.dispatcher.rs.DispatcherServiceImpl;
import org.onap.optf.cmso.filters.CMSOContainerFilters;
import org.onap.optf.cmso.service.rs.AdminToolImpl;
-import org.onap.optf.cmso.service.rs.CMSCallbackImpl;
+import org.onap.optf.cmso.service.rs.CMSOOptimizerCallbackImpl;
import org.onap.optf.cmso.service.rs.CMSOServiceImpl;
import org.onap.optf.cmso.service.rs.HealthCheckImpl;
import org.onap.optf.cmso.test.loopback.SchedulerTestLoopbackServiceImpl;
@@ -76,7 +76,7 @@ public class JerseyConfiguration extends ResourceConfig {
@Autowired
public JerseyConfiguration( /* LogRequestFilter lrf */ ) {
register(CMSOServiceImpl.class);
- register(CMSCallbackImpl.class);
+ register(CMSOOptimizerCallbackImpl.class);
register(SchedulerTestLoopbackServiceImpl.class);
register(TicketMgtLoopbackServiceImpl.class);
register(HealthCheckImpl.class);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java
index 880566a..f29d6c6 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmJob.java
@@ -32,6 +32,7 @@
package org.onap.optf.cmso.dispatcher;
import java.util.Map;
+import java.util.UUID;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
@@ -103,19 +104,19 @@ public class CmJob implements Job {
public void execute(JobExecutionContext context) throws JobExecutionException {
Mdc.quartzJobBegin(context);
debug.debug(LogMessages.CM_JOB, "Entered");
- Integer id = context.getJobDetail().getJobDataMap().getInt("key");
+ String id = context.getJobDetail().getJobDataMap().getString("key");
try {
// Hand this off to a transactional service
loopback(id);
} catch (Exception e) {
log.warn("Unexpected exception", e);
} finally {
- dispatchedEventList.remove(id);
+ dispatchedEventList.remove(UUID.fromString(id));
}
debug.debug(LogMessages.CM_JOB, "Exited");
}
- public void loopback(Integer id) {
+ public void loopback(String id) {
Map<String, String> mdcSave = Mdc.save();
try {
String url = env.getProperty("cmso.dispatch.url", "http://localhost:8089");
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java
index cb8597f..60d8bdb 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,8 @@ import java.net.InetAddress;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
+import java.util.UUID;
+
import org.onap.optf.cmso.common.CMSStatusEnum;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.model.ChangeManagementGroup;
@@ -52,6 +54,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.eelf.i18n.EELFResourceManager;
@@ -86,15 +89,15 @@ public class DispatchJob {
@Autowired
Environment env;
- public void execute(Integer id) throws JobExecutionException {
+ public void execute(UUID id) throws JobExecutionException {
debug.debug(LogMessages.CM_JOB, "Entered");
try {
// No other instance can read this cmso until we are done.
ChangeManagementSchedule cmSchedule = cmScheduleDAO.lockOne(id);
cmSchedule.setDispatcherInstance(InetAddress.getLocalHost().getHostAddress());
- ChangeManagementGroup group = cmGroupDAO.findById(cmSchedule.getChangeManagementGroupsId()).orElse(null);
+ ChangeManagementGroup group = cmGroupDAO.findById(cmSchedule.getChangeManagementGroupUuid()).orElse(null);
if (group != null) {
- Schedule schedule = scheduleDAO.findById(group.getSchedulesId()).orElse(null);
+ Schedule schedule = scheduleDAO.findById(group.getSchedulesUuid()).orElse(null);
if (schedule != null) {
schedule.setStatus(CMSStatusEnum.NotificationsInitiated.toString());
if (safeToDispatch(cmSchedule, schedule))
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispacherService.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispacherService.java
index d0ff299..3c53759 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispacherService.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispacherService.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,6 +40,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -58,7 +59,7 @@ public interface DispacherService {
@ApiOperation(value = "", notes = "Does dispsatch of provided cm schedule id.", response = Integer.class)
@ApiResponses(
value = {@ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 400, message = "Request failed")})
- public Response dispatchSchedule(@ApiParam(value = "Identifier", allowMultiple = false) @PathParam("id") Integer id,
+ public Response dispatchSchedule(@ApiParam(value = "Identifier", allowMultiple = false) @PathParam("id") String id,
@Context UriInfo uri, @Context HttpServletRequest request);
// ******************************************************************
@@ -69,7 +70,7 @@ public interface DispacherService {
@ApiResponses(
value = {@ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 400, message = "Request failed")})
public Response dispatchOptimizer(
- @ApiParam(value = "Identifier", allowMultiple = false) @PathParam("id") Integer id, @Context UriInfo uri,
+ @ApiParam(value = "Identifier", allowMultiple = false) @PathParam("id") String id, @Context UriInfo uri,
@Context HttpServletRequest request);
// ******************************************************************
@@ -80,7 +81,7 @@ public interface DispacherService {
@ApiResponses(
value = {@ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 400, message = "Request failed")})
public Response dispatchScheduleStatus(
- @ApiParam(value = "Identifier", allowMultiple = false) @PathParam("id") Integer id, @Context UriInfo uri,
+ @ApiParam(value = "Identifier", allowMultiple = false) @PathParam("id") String id, @Context UriInfo uri,
@Context HttpServletRequest request);
// ******************************************************************
@@ -90,7 +91,7 @@ public interface DispacherService {
@ApiOperation(value = "", notes = "Does dispsatch of provided cm schedule id.", response = Integer.class)
@ApiResponses(
value = {@ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 400, message = "Request failed")})
- public Response dispatchSoStatus(@ApiParam(value = "Identifier", allowMultiple = true) @PathParam("id") Integer id,
+ public Response dispatchSoStatus(@ApiParam(value = "Identifier", allowMultiple = true) @PathParam("id") String id,
@Context UriInfo uri, @Context HttpServletRequest request);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java
index 3aab301..feea350 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java
@@ -31,6 +31,8 @@
package org.onap.optf.cmso.dispatcher.rs;
+import java.util.UUID;
+
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
@@ -58,7 +60,7 @@ public class DispatcherServiceImpl implements DispacherService {
DispatchJob dispatchJob;
@Autowired
- CMSOptimizerClient sniroClient;
+ CMSOptimizerClient optimizerClient;
@Autowired
TmStatusClient tmStatusClient;
@@ -68,10 +70,11 @@ public class DispatcherServiceImpl implements DispacherService {
@Override
@Transactional
- public Response dispatchSchedule(Integer id, UriInfo uri, HttpServletRequest request) {
+ public Response dispatchSchedule(String id, UriInfo uri, HttpServletRequest request) {
debug.debug("dispatchSchedule entered {}" , id);
try {
- dispatchJob.execute(id);
+ UUID uuid = UUID.fromString(id);
+ dispatchJob.execute(uuid);
} catch (Exception e) {
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
debug.error(e.getMessage(), e);
@@ -82,10 +85,11 @@ public class DispatcherServiceImpl implements DispacherService {
@Override
@Transactional
- public Response dispatchOptimizer(Integer id, UriInfo uri, HttpServletRequest request) {
+ public Response dispatchOptimizer(String id, UriInfo uri, HttpServletRequest request) {
debug.debug("dispatchOptimizer entered {}", id);
try {
- sniroClient.scheduleSniroOptimization(id);
+ UUID uuid = UUID.fromString(id);
+ optimizerClient.scheduleOptimization(uuid);
} catch (Exception e) {
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
debug.error(e.getMessage(), e);
@@ -97,7 +101,7 @@ public class DispatcherServiceImpl implements DispacherService {
@Override
@Transactional
- public Response dispatchScheduleStatus(Integer id, UriInfo uri, HttpServletRequest request) {
+ public Response dispatchScheduleStatus(String id, UriInfo uri, HttpServletRequest request) {
debug.debug("dispatchScheduleStatus entered {}", id);
try {
tmStatusClient.checkStatus(id);
@@ -111,7 +115,7 @@ public class DispatcherServiceImpl implements DispacherService {
@Override
@Transactional
- public Response dispatchSoStatus(Integer id, UriInfo uri, HttpServletRequest request) {
+ public Response dispatchSoStatus(String id, UriInfo uri, HttpServletRequest request) {
debug.debug("dispatchSoStatus entered {}", id);
try {
msoStatusClient.execute(id);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java
index 59df59f..0987f8b 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -87,9 +87,9 @@ public class CMSQueueJob {
return false;
for (ChangeManagementSchedule schedule : schedules) {
try {
- if (!dispatchedEventList.isAlreadyDispatched(schedule.getId())) {
+ if (!dispatchedEventList.isAlreadyDispatched(schedule.getUuid())) {
scheduleCmJob(schedule);
- dispatchedEventList.addToDispathcedEventList(schedule.getId());
+ dispatchedEventList.addToDispathcedEventList(schedule.getUuid());
}
} catch (org.quartz.SchedulerException e) {
debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
@@ -118,7 +118,7 @@ public class CMSQueueJob {
dispatchTime = startTime - dispatherLeadTime;
JobDetail jobDetail = JobBuilder.newJob(CmJob.class).build();
- jobDetail.getJobDataMap().put("key", schedule.getId());
+ jobDetail.getJobDataMap().put("key", schedule.getUuid().toString());
TriggerBuilder<Trigger> tb = TriggerBuilder.newTrigger().forJob(jobDetail);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/DispatchedEventList.java b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/DispatchedEventList.java
index 0c346d3..3e02cd1 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/DispatchedEventList.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/DispatchedEventList.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +33,8 @@ package org.onap.optf.cmso.eventq;
import java.util.HashSet;
import java.util.Set;
+import java.util.UUID;
+
import org.springframework.stereotype.Component;
/**
@@ -45,18 +47,18 @@ import org.springframework.stereotype.Component;
@Component
public class DispatchedEventList {
- private Set<Integer> list = new HashSet<>();
+ private Set<UUID> list = new HashSet<>();
- public synchronized void addToDispathcedEventList(Integer id) {
+ public synchronized void addToDispathcedEventList(UUID id) {
list.add(id);
}
- public synchronized void remove(Integer id) {
+ public synchronized void remove(UUID id) {
list.remove(id);
}
- public synchronized boolean isAlreadyDispatched(Integer id) {
- return list.contains(id);
+ public synchronized boolean isAlreadyDispatched(UUID uuid) {
+ return list.contains(uuid);
}
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java
index 121774b..6009040 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java
@@ -32,10 +32,10 @@
package org.onap.optf.cmso.model;
import java.io.Serializable;
+import java.util.UUID;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@@ -51,8 +51,7 @@ public class ApprovalType implements Serializable {
private static final long serialVersionUID = 1L;
@Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
+ private UUID uuid;
@Column(name = "approval_count")
private Integer approvalCount;
@@ -66,15 +65,18 @@ public class ApprovalType implements Serializable {
public ApprovalType() {}
- public Integer getId() {
- return this.id;
- }
- public void setId(Integer id) {
- this.id = id;
- }
+ public UUID getUuid() {
+ return uuid;
+ }
+
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
- public Integer getApprovalCount() {
+ public Integer getApprovalCount() {
return this.approvalCount;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java
index 7224508..210e61a 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java
@@ -32,17 +32,20 @@
package org.onap.optf.cmso.model;
import java.io.Serializable;
+import java.util.UUID;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
+
import org.joda.time.format.ISODateTimeFormat;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -59,8 +62,7 @@ public class ChangeManagementChangeWindow implements Serializable {
@JsonIgnore
@Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
+ private UUID uuid;
@JsonIgnore
@Column(name = "finish_time")
@@ -81,18 +83,11 @@ public class ChangeManagementChangeWindow implements Serializable {
private String startTime;
@JsonIgnore
- @Column(name = "change_management_groups_id")
- private Integer changeManagementGroupsId;
+ @Column(name = "change_management_group_uuid")
+ private UUID changeManagementGroupUuid;
public ChangeManagementChangeWindow() {}
- public Integer getId() {
- return this.id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
public String getFinishTime() {
if (finishTimeMillis != null)
@@ -110,15 +105,29 @@ public class ChangeManagementChangeWindow implements Serializable {
public void setStartTime(String startTime) {}
- public Integer getChangeManagementGroupsId() {
- return changeManagementGroupsId;
- }
- public void setChangeManagementGroupsId(Integer changeManagementGroupsId) {
- this.changeManagementGroupsId = changeManagementGroupsId;
- }
+ public UUID getUuid() {
+ return uuid;
+ }
+
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+
+
+ public UUID getChangeManagementGroupUuid() {
+ return changeManagementGroupUuid;
+ }
+
+
+ public void setChangeManagementGroupUuid(UUID changeManagementGroupUuid) {
+ this.changeManagementGroupUuid = changeManagementGroupUuid;
+ }
+
- public Long getFinishTimeMillis() {
+ public Long getFinishTimeMillis() {
return finishTimeMillis;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java
index 31c4a2b..4f0e804 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java
@@ -31,16 +31,19 @@
package org.onap.optf.cmso.model;
+import java.util.UUID;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Transient;
+
import org.joda.time.format.ISODateTimeFormat;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -59,8 +62,7 @@ import io.swagger.annotations.ApiModelProperty;
public class ChangeManagementDetail {
@Id
@JsonIgnore
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
+ private UUID uuid;
@ApiModelProperty(value = "Name of the VNF.")
@Column(name = "vnf_name")
@@ -168,7 +170,8 @@ public class ChangeManagementDetail {
private String msoTime;
@JsonIgnore
- private Integer schedules_id;
+ @Column(name = "schedules_uuid")
+ private UUID schedulesUuid;
public String getVnfName() {
return vnfName;
@@ -242,15 +245,27 @@ public class ChangeManagementDetail {
this.policyId = policyId;
}
- public Integer getSchedulesId() {
- return schedules_id;
- }
- public void setSchedulesId(Integer schedules_id) {
- this.schedules_id = schedules_id;
- }
+ public UUID getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+
+
+
+ public UUID getSchedulesUuid() {
+ return schedulesUuid;
+ }
+
+ public void setSchedulesUuid(UUID schedulesUuid) {
+ this.schedulesUuid = schedulesUuid;
+ }
- public Long getStartTimeMillis() {
+ public Long getStartTimeMillis() {
return startTimeMillis;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java
index 6aeb325..39efb3f 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java
@@ -33,17 +33,20 @@ package org.onap.optf.cmso.model;
import java.io.Serializable;
import java.util.List;
+import java.util.UUID;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
+
import org.joda.time.format.ISODateTimeFormat;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -60,8 +63,7 @@ public class ChangeManagementGroup implements Serializable {
@JsonIgnore
@Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
+ private UUID uuid;
@JsonIgnore
@Column(name = "finish_time")
@@ -95,8 +97,8 @@ public class ChangeManagementGroup implements Serializable {
private String startTime;
@JsonIgnore
- @Column(name = "schedules_id")
- private Integer schedulesId;
+ @Column(name = "schedules_uuid")
+ private UUID schedulesUuid;
@Column(name = "additional_duration_in_secs")
@ApiModelProperty(value = "Time added to the workflow interval to allow for rollback in case of failure.")
@@ -122,13 +124,6 @@ public class ChangeManagementGroup implements Serializable {
public ChangeManagementGroup() {}
- public Integer getId() {
- return this.id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
public String getFinishTime() {
if (finishTimeMillis != null)
@@ -162,13 +157,6 @@ public class ChangeManagementGroup implements Serializable {
public void setStartTime(String startTime) {}
- public Integer getSchedulesId() {
- return schedulesId;
- }
-
- public void setSchedulesId(Integer schedulesId) {
- this.schedulesId = schedulesId;
- }
public Integer getAdditionalDurationInSecs() {
return additionalDurationInSecs;
@@ -234,4 +222,24 @@ public class ChangeManagementGroup implements Serializable {
this.changeManagementSchedules = changeManagementSchedules;
}
+
+ public UUID getUuid() {
+ return uuid;
+ }
+
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+
+ public UUID getSchedulesUuid() {
+ return schedulesUuid;
+ }
+
+
+ public void setSchedulesUuid(UUID schedulesUuid) {
+ this.schedulesUuid = schedulesUuid;
+ }
+
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java
index 9690290..680fc99 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java
@@ -32,18 +32,21 @@
package org.onap.optf.cmso.model;
import java.io.Serializable;
+import java.util.UUID;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
+
import org.joda.time.format.ISODateTimeFormat;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -61,8 +64,7 @@ public class ChangeManagementSchedule implements Serializable {
@JsonIgnore
@Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
+ private UUID uuid;
@ApiModelProperty(value = "TM Change Id")
@Column(name = "tm_change_id")
@@ -107,9 +109,9 @@ public class ChangeManagementSchedule implements Serializable {
@Column(name = "vnf_name")
private String vnfName;
- @Column(name = "change_management_groups_id")
+ @Column(name = "change_management_group_uuid")
@JsonIgnore
- private Integer changeManagementGroupsId;
+ private UUID changeManagementGroupUuid;
@JsonIgnore
@Column(name = "dispatch_time")
@@ -162,14 +164,6 @@ public class ChangeManagementSchedule implements Serializable {
public ChangeManagementSchedule() {}
- public Integer getId() {
- return this.id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
public String getFinishTime() {
if (finishTimeMillis != null)
return ISODateTimeFormat.dateTimeNoMillis().print(finishTimeMillis);
@@ -218,15 +212,25 @@ public class ChangeManagementSchedule implements Serializable {
this.tmChangeId = tmChangeId;
}
- public Integer getChangeManagementGroupsId() {
- return changeManagementGroupsId;
- }
- public void setChangeManagementGroupsId(Integer changeManagementGroupsId) {
- this.changeManagementGroupsId = changeManagementGroupsId;
- }
+ public UUID getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+
+ public UUID getChangeManagementGroupUuid() {
+ return changeManagementGroupUuid;
+ }
+
+ public void setChangeManagementGroupUuid(UUID changeManagementGroupUuid) {
+ this.changeManagementGroupUuid = changeManagementGroupUuid;
+ }
- public String getDispatchTime() {
+ public String getDispatchTime() {
if (dispatchTimeMillis != null)
return ISODateTimeFormat.dateTimeNoMillis().print(dispatchTimeMillis);
return null;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java
index fc86964..3bb0bea 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java
@@ -32,15 +32,17 @@
package org.onap.optf.cmso.model;
import java.io.Serializable;
+import java.util.UUID;
+
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
+
import io.swagger.annotations.ApiModel;
/**
@@ -56,29 +58,31 @@ public class DomainData implements Serializable {
@JsonIgnore
@Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
+ private UUID uuid;
private String name;
private String value;
@ManyToOne(optional = true)
- @JoinColumn(name = "schedules_id", nullable = false, updatable = false)
+ @JoinColumn(name = "schedules_uuid", nullable = false, updatable = false)
@JsonIgnore
private Schedule schedule;
public DomainData() {}
- public Integer getId() {
- return this.id;
- }
- public void setId(Integer id) {
- this.id = id;
- }
+ public UUID getUuid() {
+ return uuid;
+ }
+
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
- public String getName() {
+ public String getName() {
return this.name;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/HelloWorld.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/HelloWorld.java
deleted file mode 100644
index ed09ad7..0000000
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/HelloWorld.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-package org.onap.optf.cmso.model;
-
-public class HelloWorld {
-
- private String message;
-
- public HelloWorld() {
- // needed for deserializer
- }
-
- public HelloWorld(String message) {
- this.message = message;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- @Override
- public String toString() {
- return "message = " + getMessage();
- }
-}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java
index d6fe4f9..624e376 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java
@@ -34,22 +34,25 @@ package org.onap.optf.cmso.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
+import java.util.UUID;
+
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
+
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.joda.time.format.ISODateTimeFormat;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.annotations.ApiModelProperty;
/**
@@ -64,8 +67,7 @@ public class Schedule implements Serializable {
@JsonIgnore
@Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
+ private UUID uuid;
@JsonIgnore
@Column(name = "create_date_time")
@@ -160,15 +162,23 @@ public class Schedule implements Serializable {
public Schedule() {}
- public Integer getId() {
- return this.id;
- }
+ public UUID getUuid() {
+ return uuid;
+ }
- public void setId(Integer id) {
- this.id = id;
- }
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+ public void setDomainData(List<DomainData> domainData) {
+ this.domainData = domainData;
+ }
+
+ public void setScheduleApprovals(List<ScheduleApproval> scheduleApprovals) {
+ this.scheduleApprovals = scheduleApprovals;
+ }
- public String getCreateDateTime() {
+ public String getCreateDateTime() {
if (createDateTimeMillis != null)
return ISODateTimeFormat.dateTimeNoMillis().print(this.createDateTimeMillis);
return null;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java
index dee3c42..3239ae3 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java
@@ -32,19 +32,22 @@
package org.onap.optf.cmso.model;
import java.io.Serializable;
+import java.util.UUID;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
+
import org.joda.time.format.ISODateTimeFormat;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -60,9 +63,8 @@ public class ScheduleApproval implements Serializable {
private static final long serialVersionUID = 1L;
@Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
@JsonIgnore
- private Integer id;
+ private UUID uuid;
@JsonIgnore
@Column(name = "approval_date_time")
@@ -82,23 +84,16 @@ public class ScheduleApproval implements Serializable {
private String userId;
@ManyToOne(optional = true)
- @JoinColumn(name = "schedules_id", nullable = false, updatable = false)
+ @JoinColumn(name = "schedules_uuid", nullable = false, updatable = false)
@JsonIgnore
private Schedule schedule;
@JsonIgnore
- @Column(name = "approval_type_id")
- private Integer approvalTypeId;
+ @Column(name = "approval_types_uuid")
+ private UUID approvalTypesUuid;
public ScheduleApproval() {}
- public Integer getId() {
- return this.id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
public String getApprovalDateTime() {
if (approvalDateTimeMillis != null)
@@ -124,13 +119,6 @@ public class ScheduleApproval implements Serializable {
this.userId = userId;
}
- public Integer getApprovalTypeId() {
- return approvalTypeId;
- }
-
- public void setApprovalTypeId(Integer approvalTypeId) {
- this.approvalTypeId = approvalTypeId;
- }
public void setSchedule(Schedule schedule) {
this.schedule = schedule;
@@ -148,4 +136,26 @@ public class ScheduleApproval implements Serializable {
this.approvalDateTimeMillis = approvalDateTimeMillis;
}
+
+ public UUID getUuid() {
+ return uuid;
+ }
+
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+
+ public UUID getApprovalTypesUuid() {
+ return approvalTypesUuid;
+ }
+
+
+ public void setApprovalTypesUuid(UUID approvalTypesUuid) {
+ this.approvalTypesUuid = approvalTypesUuid;
+ }
+
+
+
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java
deleted file mode 100644
index 46cb46e..0000000
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-package org.onap.optf.cmso.model;
-
-import java.io.Serializable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Lob;
-import javax.persistence.NamedQuery;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-import org.joda.time.format.ISODateTimeFormat;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * The persistent class for the schedule_events database table.
- *
- */
-@Entity
-@Table(name = "SCHEDULE_EVENTS")
-@NamedQuery(name = "ScheduleEvent.findAll", query = "SELECT s FROM ScheduleEvent s")
-public class ScheduleEvent implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- private Integer id;
-
- private String domain;
-
- @Lob
- @Column(name = "event_text")
- private String eventText;
-
- @JsonIgnore
- @Column(name = "event_time")
- private Long eventTimeMillis;
-
- @JsonProperty
- @Transient
- private String eventTime;
-
- @JsonIgnore
- @Column(name = "reminder_time")
- private Long reminderTimeMillis;
-
- @JsonProperty
- @Transient
- private String reminderTime;
-
- @Column(name = "schedules_id")
- private Integer schedulesId;
-
- private String status;
-
- public ScheduleEvent() {}
-
- public Integer getId() {
- return this.id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getDomain() {
- return this.domain;
- }
-
- public void setDomain(String domain) {
- this.domain = domain;
- }
-
- public String getEventText() {
- return this.eventText;
- }
-
- public void setEventText(String eventText) {
- this.eventText = eventText;
- }
-
- public Integer getSchedulesId() {
- return this.schedulesId;
- }
-
- public void setSchedulesId(Integer schedulesId) {
- this.schedulesId = schedulesId;
- }
-
- public String getStatus() {
- return this.status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public Long getEventTimeMillis() {
- return eventTimeMillis;
- }
-
- public void setEventTimeMillis(Long eventTimeMillis) {
- this.eventTimeMillis = eventTimeMillis;
- }
-
- public String getEventTime() {
- if (eventTimeMillis != null)
- return ISODateTimeFormat.dateTimeNoMillis().print(this.eventTimeMillis);
- return null;
- }
-
- public void setEventTime(String eventTime) {}
-
- public Long getReminderTimeMillis() {
- return reminderTimeMillis;
- }
-
- public void setReminderTimeMillis(Long reminderTimeMillis) {
- this.reminderTimeMillis = reminderTimeMillis;
- }
-
- public String getReminderTime() {
- if (reminderTimeMillis != null)
- return ISODateTimeFormat.dateTimeNoMillis().print(this.reminderTimeMillis);
- return null;
- }
-
- public void setReminderTime(String reminderTime) {}
-
-}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleQuery.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleQuery.java
index 84d3e5c..628fc6f 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleQuery.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleQuery.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,6 +31,8 @@
package org.onap.optf.cmso.model;
+import java.util.UUID;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
@@ -38,15 +40,16 @@ import javax.persistence.Id;
@Entity
public class ScheduleQuery {
@Id
- @Column(name = "id")
- private Integer id;
+ @Column(name = "uuid")
+ private UUID uuid;
+
+ public UUID getUuid() {
+ return uuid;
+ }
- public Integer getId() {
- return id;
- }
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
- public void setId(Integer id) {
- this.id = id;
- }
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java
index 7eb2430..9e4b546 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ApprovalTypeDAO.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,12 +33,14 @@ package org.onap.optf.cmso.model.dao;
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
+
import org.onap.optf.cmso.model.ApprovalType;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ApprovalTypeDAO extends PagingAndSortingRepository<ApprovalType, Integer> {
- Optional<ApprovalType> findById(Integer id);
+public interface ApprovalTypeDAO extends PagingAndSortingRepository<ApprovalType, UUID> {
+ Optional<ApprovalType> findById(UUID id);
ApprovalType save(ApprovalType persisted);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDAO.java
index 293209e..303be20 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDAO.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementChangeWindowDAO.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,24 +33,26 @@ package org.onap.optf.cmso.model.dao;
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
+
import org.onap.optf.cmso.model.ChangeManagementChangeWindow;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface ChangeManagementChangeWindowDAO
- extends PagingAndSortingRepository<ChangeManagementChangeWindow, Integer> {
- Optional<ChangeManagementChangeWindow> findById(Integer id);
+ extends PagingAndSortingRepository<ChangeManagementChangeWindow, UUID> {
+ Optional<ChangeManagementChangeWindow> findById(UUID id);
ChangeManagementChangeWindow save(ChangeManagementChangeWindow persisted);
void delete(ChangeManagementChangeWindow toDelete);
- @Query(value = "SELECT d FROM ChangeManagementChangeWindow d WHERE d.changeManagementGroupsId = ?1")
- List<ChangeManagementChangeWindow> findByGroupsID(Integer id);
+ @Query(value = "SELECT d FROM ChangeManagementChangeWindow d WHERE d.changeManagementGroupUuid = ?1")
+ List<ChangeManagementChangeWindow> findByGroupsUUID(UUID id);
@Modifying
- @Query(value = "DELETE FROM ChangeManagementChangeWindow d WHERE d.changeManagementGroupsId = ?1")
- int deleteByChangeManagementGroupId(int id);
+ @Query(value = "DELETE FROM ChangeManagementChangeWindow d WHERE d.changeManagementGroupUuid = ?1")
+ int deleteByChangeManagementGroupUuid(UUID id);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java
index 2c083d6..028241c 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ public class ChangeManagementDetailDAOImpl implements ChangeManagementDetailDAO
@Override
public List<ChangeManagementDetail> searchScheduleDetails(String where, int limit) {
StringBuilder sql = new StringBuilder();
- sql.append("select distinct" + " s.id as id," + " s.vnf_name as vnf_name," + " s.vnf_id as vnf_id,"
+ sql.append("select distinct" + " s.uuid as uuid," + " s.vnf_name as vnf_name," + " s.vnf_id as vnf_id,"
+ " s.status as status," + " s.tm_change_id as tm_change_Id," + " s.start_time as start_time,"
+ " s.finish_time as finish_time," + " s.mso_request_id as mso_request_id,"
+ " s.mso_status as mso_status," + " s.mso_message as mso_message," + " s.mso_time as mso_time,"
@@ -54,17 +54,17 @@ public class ChangeManagementDetailDAOImpl implements ChangeManagementDetailDAO
+ " s.status_message as status_message," + " s.tm_approval_status as tm_approval_status,"
+ " s.tm_status as tm_status," + " g.group_id as group_id,"
+ " g.last_instance_start_time as last_instance_start_time," + " g.policy_id as policy_id,"
- + " g.schedules_id as schedules_id"
+ + " g.schedules_uuid as schedules_uuid"
// + " ss.schedule_id as scheduleId,"
// + " dd.name"
+ " from" + " CHANGE_MANAGEMENT_SCHEDULES s"
- + " inner join CHANGE_MANAGEMENT_GROUPS g on s.change_management_groups_id = g.id"
- + " inner join SCHEDULES ss on g.schedules_id = ss.id "
- + " left outer join DOMAIN_DATA dd on ss.id = dd.schedules_id"
- + " left outer join SCHEDULE_APPROVALS sa on ss.id = sa.schedules_id"
- + " left outer join APPROVAL_TYPES at on sa.approval_type_id = at.id ");
+ + " inner join CHANGE_MANAGEMENT_GROUPS g on s.change_management_group_uuid = g.uuid"
+ + " inner join SCHEDULES ss on g.schedules_uuid = ss.uuid "
+ + " left outer join DOMAIN_DATA dd on ss.uuid = dd.schedules_uuid"
+ + " left outer join SCHEDULE_APPROVALS sa on ss.uuid = sa.schedules_uuid"
+ + " left outer join APPROVAL_TYPES at on sa.approval_types_uuid = at.uuid ");
sql.append(where);
- sql.append(" order by id ");
+ sql.append(" order by uuid ");
if (limit > 0)
sql.append("LIMIT " + limit);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDAO.java
index 39f4baa..7acc228 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDAO.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementGroupDAO.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,21 +33,23 @@ package org.onap.optf.cmso.model.dao;
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
+
import org.onap.optf.cmso.model.ChangeManagementGroup;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ChangeManagementGroupDAO extends PagingAndSortingRepository<ChangeManagementGroup, Integer> {
- Optional<ChangeManagementGroup> findById(Integer id);
+public interface ChangeManagementGroupDAO extends PagingAndSortingRepository<ChangeManagementGroup, UUID> {
+ Optional<ChangeManagementGroup> findById(UUID id);
ChangeManagementGroup save(ChangeManagementGroup persisted);
void delete(ChangeManagementGroup toDelete);
- @Query(value = "SELECT d FROM ChangeManagementGroup d WHERE d.schedulesId = ?1")
- List<ChangeManagementGroup> findBySchedulesID(Integer id);
+ @Query(value = "SELECT d FROM ChangeManagementGroup d WHERE d.schedulesUuid = ?1")
+ List<ChangeManagementGroup> findBySchedulesID(UUID id);
- @Query(value = "SELECT d FROM ChangeManagementGroup d WHERE d.schedulesId = ?1 AND d.groupId = ?2")
- ChangeManagementGroup findOneBySchedulesIDGroupID(Integer id, String groupId);
+ @Query(value = "SELECT d FROM ChangeManagementGroup d WHERE d.schedulesUuid = ?1 AND d.groupId = ?2")
+ ChangeManagementGroup findOneBySchedulesIDGroupID(UUID id, String groupId);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java
index a089c2b..ad01a34 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementScheduleDAO.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,29 +33,32 @@ package org.onap.optf.cmso.model.dao;
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
+
import javax.persistence.LockModeType;
+
import org.onap.optf.cmso.model.ChangeManagementSchedule;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ChangeManagementScheduleDAO extends PagingAndSortingRepository<ChangeManagementSchedule, Integer> {
- Optional<ChangeManagementSchedule> findById(Integer id);
+public interface ChangeManagementScheduleDAO extends PagingAndSortingRepository<ChangeManagementSchedule, UUID> {
+ Optional<ChangeManagementSchedule> findById(UUID id);
ChangeManagementSchedule save(ChangeManagementSchedule persisted);
void delete(ChangeManagementSchedule toDelete);
- @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.changeManagementGroupsId = ?1")
- List<ChangeManagementSchedule> findByChangeManagementGroupId(Integer id);
+ @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.changeManagementGroupUuid = ?1")
+ List<ChangeManagementSchedule> findByChangeManagementGroupId(UUID id);
@Modifying
- @Query(value = "DELETE FROM ChangeManagementSchedule d WHERE d.changeManagementGroupsId = ?1")
- public int deleteByChangeManagementGroupsId(Integer id);
+ @Query(value = "DELETE FROM ChangeManagementSchedule d WHERE d.changeManagementGroupUuid = ?1")
+ public int deleteByChangeManagementGroupsId(UUID id);
- @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.changeManagementGroupsId = ?1 AND d.vnfName = ?2")
- ChangeManagementSchedule findOneByGroupIDAndVnfName(Integer id, String vnfName);
+ @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.changeManagementGroupUuid = ?1 AND d.vnfName = ?2")
+ ChangeManagementSchedule findOneByGroupIDAndVnfName(UUID id, String vnfName);
@Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE (d.status = ?1 AND d.startTimeMillis <= ?2) or d.status = 'Scheduled Immediate' order by d.startTimeMillis")
List<ChangeManagementSchedule> findByStatusAndEndTime(String status, Long date);
@@ -70,8 +73,8 @@ public interface ChangeManagementScheduleDAO extends PagingAndSortingRepository<
@Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.tmApprovalStatus = 'Pending Approval'")
List<ChangeManagementSchedule> findAllAwaitingTmApproval();
- @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.id = ?1")
+ @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.uuid = ?1")
@Lock(LockModeType.PESSIMISTIC_WRITE)
- ChangeManagementSchedule lockOne(Integer id);
+ ChangeManagementSchedule lockOne(UUID id);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java
index 9556938..75299a1 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/DomainDataDAO.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,11 +32,13 @@
package org.onap.optf.cmso.model.dao;
import java.util.Optional;
+import java.util.UUID;
+
import org.onap.optf.cmso.model.DomainData;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface DomainDataDAO extends PagingAndSortingRepository<DomainData, Integer> {
- Optional<DomainData> findById(Integer id);
+public interface DomainDataDAO extends PagingAndSortingRepository<DomainData, UUID> {
+ Optional<DomainData> findById(UUID id);
DomainData save(DomainData persisted);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDAO.java
index d9badd0..3fabd63 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDAO.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleApprovalDAO.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,11 +32,13 @@
package org.onap.optf.cmso.model.dao;
import java.util.Optional;
+import java.util.UUID;
+
import org.onap.optf.cmso.model.ScheduleApproval;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ScheduleApprovalDAO extends PagingAndSortingRepository<ScheduleApproval, Integer> {
- Optional<ScheduleApproval> findById(Integer id);
+public interface ScheduleApprovalDAO extends PagingAndSortingRepository<ScheduleApproval, UUID> {
+ Optional<ScheduleApproval> findById(UUID id);
ScheduleApproval save(ScheduleApproval persisted);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDAO.java
index f68fd22..90843c4 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDAO.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleDAO.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,14 +33,17 @@ package org.onap.optf.cmso.model.dao;
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
+
import javax.persistence.LockModeType;
+
import org.onap.optf.cmso.model.Schedule;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-public interface ScheduleDAO extends PagingAndSortingRepository<Schedule, Integer> {
- Optional<Schedule> findById(Integer id);
+public interface ScheduleDAO extends PagingAndSortingRepository<Schedule, UUID> {
+ Optional<Schedule> findById(UUID id);
Schedule save(Schedule persited);
@@ -58,9 +61,9 @@ public interface ScheduleDAO extends PagingAndSortingRepository<Schedule, Intege
@Query(value = "SELECT s FROM Schedule s WHERE s.domain = ?1 AND s.status = 'Notifications Initiated'")
List<Schedule> findAllInProgress(String string);
- @Query(value = "SELECT d FROM Schedule d WHERE d.id = ?1")
+ @Query(value = "SELECT d FROM Schedule d WHERE d.uuid = ?1")
@Lock(LockModeType.PESSIMISTIC_WRITE)
- Schedule lockOne(Integer id);
+ Schedule lockOne(UUID id);
@Query(value = "SELECT s FROM Schedule s WHERE s.optimizerTransactionId= ?1")
@Lock(LockModeType.PESSIMISTIC_WRITE)
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleEventDAO.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleEventDAO.java
deleted file mode 100644
index c3c2483..0000000
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleEventDAO.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-package org.onap.optf.cmso.model.dao;
-
-import java.util.List;
-import java.util.Optional;
-import org.onap.optf.cmso.model.ScheduleEvent;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.PagingAndSortingRepository;
-
-public interface ScheduleEventDAO extends PagingAndSortingRepository<ScheduleEvent, Integer> {
- Optional<ScheduleEvent> findById(Integer id);
-
- ScheduleEvent save(ScheduleEvent persisted);
-
- void delete(ScheduleEvent toDelete);
-
- @Query(value = "SELECT d FROM ScheduleEvent d WHERE d.schedulesId = ?1")
- List<ScheduleEvent> findByScheduleId(Integer id);
-
- @Query(value = "SELECT d FROM ScheduleEvent d WHERE d.status = ?1 AND d.reminderTimeMillis <= ?2")
- List<ScheduleEvent> findByStatusAndEndTime(String status, Long date);
-
-}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAOImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAOImpl.java
index 37fbf52..80bb7f0 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAOImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ScheduleQueryDAOImpl.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,14 +46,14 @@ public class ScheduleQueryDAOImpl implements ScheduleQueryDAO {
@Override
public List<ScheduleQuery> searchSchedules(String where, int limit) {
StringBuilder sql = new StringBuilder();
- sql.append("select distinct" + " ss.id as id" + " from" + " SCHEDULES ss"
- + " left outer join CHANGE_MANAGEMENT_GROUPS g on ss.id = g.schedules_id"
- + " left outer join CHANGE_MANAGEMENT_SCHEDULES s on g.id = s.change_management_groups_id"
- + " left outer join DOMAIN_DATA dd on ss.id = dd.schedules_id"
- + " left outer join SCHEDULE_APPROVALS sa on ss.id = sa.schedules_id"
- + " left outer join APPROVAL_TYPES at on sa.approval_type_id = at.id ");
+ sql.append("select distinct" + " ss.uuid as uuid" + " from" + " SCHEDULES ss"
+ + " left outer join CHANGE_MANAGEMENT_GROUPS g on ss.uuid = g.schedules_uuid"
+ + " left outer join CHANGE_MANAGEMENT_SCHEDULES s on g.uuid = s.change_management_group_uuid"
+ + " left outer join DOMAIN_DATA dd on ss.uuid = dd.schedules_uuid"
+ + " left outer join SCHEDULE_APPROVALS sa on ss.uuid = sa.schedules_uuid"
+ + " left outer join APPROVAL_TYPES at on sa.approval_types_uuid = at.uuid ");
sql.append(where);
- sql.append(" order by id ");
+ sql.append(" order by uuid ");
if (limit > 0)
sql.append("LIMIT " + limit);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CMSOptimizerClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CMSOptimizerClient.java
index 5d500d2..a773798 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CMSOptimizerClient.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CMSOptimizerClient.java
@@ -85,16 +85,16 @@ public class CMSOptimizerClient {
@Autowired
PropertiesManagement pm;
- public boolean scheduleSniroOptimization(Integer id) {
+ public boolean scheduleOptimization(UUID uuid) {
Map<String, String> mdcSave = Mdc.save();
try {
- String snirourl = env.getProperty("cmso.optimizer.url");
- String snirocallbackurl = env.getProperty("cmso.optimizer.callbackurl");
+ String optimizerurl = env.getProperty("cmso.optimizer.url");
+ String optimizercallbackurl = env.getProperty("cmso.optimizer.callbackurl");
String username = env.getProperty("mechid.user");
- Integer maxAttempts = env.getProperty("cmso.sniro.maxAttempts", Integer.class, 20);
+ Integer maxAttempts = env.getProperty("cmso.optimizer.maxAttempts", Integer.class, 20);
- // Ensure that only one cmso is requsting this call to SNIRO
- Schedule schedule = scheduleDAO.lockOne(id);
+ // Ensure that only one cmso is requsting this call to optimizer
+ Schedule schedule = scheduleDAO.lockOne(uuid);
if (!schedule.getStatus().equals(CMSStatusEnum.PendingSchedule.toString()))
return false;
@@ -116,7 +116,7 @@ public class CMSOptimizerClient {
if (info == null) {
return true;
}
- buildRequest(cmReq, info, schedule, snirocallbackurl);
+ buildRequest(cmReq, info, schedule, optimizercallbackurl);
} catch (Exception e) {
Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString());
@@ -126,34 +126,34 @@ public class CMSOptimizerClient {
}
// This service will call SNIO for each PendingOptimiztion
- // If the request is successfully scheduled in SNIRO, status will be
+ // If the request is successfully scheduled in optimizer, status will be
// updated to OptimizationInProgress.
Client client = ClientBuilder.newClient();
client.register(new BasicAuthenticatorFilter(username, password));
client.register(new CMSOClientFilters());
- WebTarget sniroTarget = client.target(snirourl);
- Invocation.Builder invocationBuilder = sniroTarget.request(MediaType.APPLICATION_JSON);
+ WebTarget optimizerTarget = client.target(optimizerurl);
+ Invocation.Builder invocationBuilder = optimizerTarget.request(MediaType.APPLICATION_JSON);
try {
//
// First, push OptimizationInProgress to the DB (flush()) assuming a 202 status,
- // in case the SNIRO callback is received prior to the
+ // in case the optimizer callback is received prior to the
// commit of this transaction.
- // SNIRO Callback will throw an error if it receives a response in the incorrect
+ // optimizer Callback will throw an error if it receives a response in the incorrect
// state.
//
schedule.setOptimizerTransactionId(cmReq.getRequestInfo().getTransactionId());
schedule.setOptimizerDateTimeMillis(System.currentTimeMillis());
schedule.setStatus(CMSStatusEnum.OptimizationInProgress.toString());
updateScheduleStatus(schedule);
- debug.debug("SNIRO url / user: " + snirourl + " / " + username);
- debug.debug("SNIRO Request: " + new ObjectMapper().writeValueAsString(cmReq));
- Observation.report(LogMessages.OPTIMIZER_REQUEST, "Begin", schedule.getScheduleId(), snirourl);
+ debug.debug("optimizer url / user: " + optimizerurl + " / " + username);
+ debug.debug("optimizer Request: " + new ObjectMapper().writeValueAsString(cmReq));
+ Observation.report(LogMessages.OPTIMIZER_REQUEST, "Begin", schedule.getScheduleId(), optimizerurl);
Response response = invocationBuilder.post(Entity.json(cmReq));
- Observation.report(LogMessages.OPTIMIZER_REQUEST, "End", schedule.getScheduleId(), snirourl);
+ Observation.report(LogMessages.OPTIMIZER_REQUEST, "End", schedule.getScheduleId(), optimizerurl);
switch (response.getStatus()) {
case 202:
debug.debug("Successfully scheduled optimization: " + schedule.getScheduleId());
- // Scheduled with SNIRO
+ // Scheduled with optimizer
break;
case 400: // Bad request
{
@@ -162,7 +162,7 @@ public class CMSOptimizerClient {
String message = response.readEntity(String.class);
schedule.setOptimizerMessage(message);
schedule.setStatus(CMSStatusEnum.ScheduleFailed.toString());
- // Need to understand the cause of this error. May be teh same as SNIRO
+ // Need to understand the cause of this error. May be teh same as optimizer
// down.
int tries = schedule.getOptimizerAttemptsToSchedule();
tries++;
@@ -195,24 +195,24 @@ public class CMSOptimizerClient {
return true;
} catch (ResponseProcessingException e) {
schedule.setOptimizerDateTimeMillis(System.currentTimeMillis());
- schedule.setOptimizerStatus("Failed to parse SNIRO response");
+ schedule.setOptimizerStatus("Failed to parse optimizer response");
schedule.setStatus(CMSStatusEnum.ScheduleFailed.toString());
- // Need to understand the cause of this error. May be teh same as SNIRO down.
+ // Need to understand the cause of this error. May be teh same as optimizer down.
int tries = schedule.getOptimizerAttemptsToSchedule();
tries++;
schedule.setOptimizerAttemptsToSchedule(tries);
updateScheduleStatus(schedule);
- // Getting invalid response from SNIRO.
+ // Getting invalid response from optimizer.
// May be data related.
Observation.report(LogMessages.OPTIMIZER_EXCEPTION, e, e.getMessage());
return false;
} catch (ProcessingException e) {
- // Don't track number of retries on IO error (SNIRO is down)
+ // Don't track number of retries on IO error (optimizer is down)
schedule.setOptimizerDateTimeMillis(System.currentTimeMillis());
schedule.setStatus(CMSStatusEnum.PendingSchedule.toString());
updateScheduleStatus(schedule);
- /// Cannot connect to SNIRO
+ /// Cannot connect to optimizer
Observation.report(LogMessages.OPTIMIZER_EXCEPTION, e, e.getMessage());
// Wait until next cycle
return false;
@@ -226,15 +226,15 @@ public class CMSOptimizerClient {
return false;
}
- private void buildRequest(CMOptimizerRequest cmReq, CMSInfo info, Schedule schedule, String snirocallbackurl) {
+ private void buildRequest(CMOptimizerRequest cmReq, CMSInfo info, Schedule schedule, String optimizercallbackurl) {
- // TODO: Need to get SNIRO to accept ChangeManagementSchedulingInfo
- // This is to support 1707 SNIRO interface
+ // TODO: Need to get optimizer to accept ChangeManagementSchedulingInfo
+ // This is to support 1707 optimizer interface
CMRequestInfo reqInfo = cmReq.getRequestInfo();
CMSchedulingInfo schInfo = cmReq.getSchedulingInfo();
UUID uuid = UUID.randomUUID();
- reqInfo.setCallbackUrl(snirocallbackurl);
+ reqInfo.setCallbackUrl(optimizercallbackurl);
reqInfo.setOptimizer(new String[] {"scheduling"});
reqInfo.setTransactionId(schedule.getOptimizerTransactionId());
reqInfo.setRequestId("CM-" + uuid.toString());
@@ -283,7 +283,7 @@ public class CMSOptimizerClient {
// Perhaps We create ChangeManagementSchedulingInfoV1, ...V2, etc.
// ANd try them one after another....
Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, "Unable to parse message. Format changed?");
- schedule.setOptimizerStatus("Failed to parse SNIRO request");
+ schedule.setOptimizerStatus("Failed to parse optimizer request");
schedule.setOptimizerDateTimeMillis(System.currentTimeMillis());
schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString());
scheduleDAO.save(schedule);
@@ -300,12 +300,12 @@ public class CMSOptimizerClient {
public HealthCheckComponent healthCheck() {
Map<String, String> mdcSave = Mdc.save();
HealthCheckComponent hcc = new HealthCheckComponent();
- hcc.setName("SNIRO Interface");
- String snirourl = env.getProperty("cmso.optimizer.url");
- String snirocallbackurl = env.getProperty("cmso.optimizer.callbackurl");
+ hcc.setName("OPtimizer Interface");
+ String optimizerurl = env.getProperty("cmso.optimizer.url");
+ String optimizercallbackurl = env.getProperty("cmso.optimizer.callbackurl");
String username = env.getProperty("mechid.user");
String password = pm.getProperty("mechid.pass", "");
- hcc.setUrl(snirourl);
+ hcc.setUrl(optimizerurl);
try {
UUID uuid = UUID.randomUUID();
// Build a bogus request should fail policy validation
@@ -335,22 +335,22 @@ public class CMSOptimizerClient {
client.register(new BasicAuthenticatorFilter(username, password));
client.register(new CMSOClientFilters());
- WebTarget sniroTarget = client.target(snirourl);
- Invocation.Builder invocationBuilder = sniroTarget.request(MediaType.APPLICATION_JSON);
- debug.debug("SNIRO url / user: " + snirourl + " / " + username);
- Observation.report(LogMessages.OPTIMIZER_REQUEST, "Begin", "healthcheck", snirourl);
+ WebTarget optimizerTarget = client.target(optimizerurl);
+ Invocation.Builder invocationBuilder = optimizerTarget.request(MediaType.APPLICATION_JSON);
+ debug.debug("Optimizer url / user: " + optimizerurl + " / " + username);
+ Observation.report(LogMessages.OPTIMIZER_REQUEST, "Begin", "healthcheck", optimizerurl);
Response response = invocationBuilder.post(Entity.json(cmReq));
- Observation.report(LogMessages.OPTIMIZER_REQUEST, "End", "healthcheck", snirourl);
+ Observation.report(LogMessages.OPTIMIZER_REQUEST, "End", "healthcheck", optimizerurl);
String message = response.getStatus() + ":" + response.readEntity(String.class);
switch (response.getStatus()) {
case 202:
- debug.debug("Successful SNIRO healthcheck");
+ debug.debug("Successful optimizer healthcheck");
hcc.setHealthy(true);
break;
case 400:
// Expecting policy not found.
if (message.contains("Cannot fetch policy")) {
- debug.debug("Successful SNIRO healthcheck");
+ debug.debug("Successful optimizer healthcheck");
hcc.setHealthy(true);
hcc.setStatus("OK");
} else {
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java
index 39d590b..12d56f3 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java
@@ -33,6 +33,8 @@ package org.onap.optf.cmso.optimizer;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
+
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Invocation;
@@ -57,6 +59,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;
+
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@@ -107,7 +110,7 @@ public class OptimizerQuartzJob extends QuartzJobBean {
}
public void scheduleOptimization(Schedule s) {
- Integer id = s.getId();
+ UUID id = s.getUuid();
Map<String, String> mdcSave = Mdc.save();
try {
String url = env.getProperty("cmso.dispatch.url", "http://localhost:8089");
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMOptimizerResponse.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMOptimizerResponse.java
index a50025b..6dd7bdf 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMOptimizerResponse.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/bean/CMOptimizerResponse.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* 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/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminTool.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminTool.java
index 801986c..10eedf8 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminTool.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminTool.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,23 +31,21 @@
package org.onap.optf.cmso.service.rs;
-import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
+
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
-@Api
+@Api("CMSO Administration")
@Path("/{apiVersion}")
@Produces({MediaType.APPLICATION_JSON})
public interface AdminTool {
@@ -60,7 +58,6 @@ public interface AdminTool {
@ApiResponses(
value = {@ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 400, message = "Request failed")})
public Response exec(@ApiParam(value = "v1|v2") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
- @ApiParam(value = "Identifier", allowMultiple = true) @PathParam("id") String id, @Context UriInfo uri,
- @Context HttpServletRequest request);
+ @ApiParam(value = "Identifier", allowMultiple = true) @PathParam("id") String id);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java
index b878d31..8ec4f4f 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java
@@ -31,32 +31,38 @@
package org.onap.optf.cmso.service.rs;
-import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
-import org.onap.observations.Mdc;
import org.onap.optf.cmso.common.PropertiesManagement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
+
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@Controller
public class AdminToolImpl implements AdminTool {
private static EELFLogger log = EELFManager.getInstance().getLogger(AdminToolImpl.class);
- private static EELFLogger audit = EELFManager.getInstance().getAuditLogger();
+
+ @Context
+ UriInfo uri;
+
+ @Context
+ HttpServletRequest request;
+
@Autowired
PropertiesManagement pm;
@Override
- public Response exec(String apiVersion, String id, UriInfo uri, HttpServletRequest request) {
+ public Response exec(String apiVersion, String id) {
log.info("AdminTool.exec entered");
if (id.length() < 4)
return Response.ok("").build();
- String encrypted = pm.getEncryptedValue(id);
+ String encrypted = PropertiesManagement.getEncryptedValue(id);
Response response = Response.ok(encrypted).build();
return response;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java
index 2e0cfeb..787bd60 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java
@@ -35,7 +35,10 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
+
import javax.ws.rs.core.Response.Status;
+
import org.onap.optf.cmso.common.ApprovalStatusEnum;
import org.onap.optf.cmso.common.CMSStatusEnum;
import org.onap.optf.cmso.common.LogMessages;
@@ -54,6 +57,7 @@ import org.onap.optf.cmso.service.rs.models.ApprovalMessage;
import org.onap.optf.cmso.service.rs.models.ScheduleMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
+
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@@ -82,6 +86,7 @@ public class BaseSchedulerServiceImpl {
throw new CMSAlreadyExistsException(scheduleMessage.getDomain(), scheduleMessage.getScheduleId());
}
s = new Schedule();
+ s.setUuid(UUID.randomUUID());
s.setUserId(scheduleMessage.getUserId());
s.setCreateDateTimeMillis(System.currentTimeMillis());
s.setDomain(scheduleMessage.getDomain());
@@ -96,6 +101,7 @@ public class BaseSchedulerServiceImpl {
s.setStatus(CMSStatusEnum.PendingSchedule.toString());
scheduleDAO.save(s);
for (DomainData dd : domainData) {
+ dd.setUuid(UUID.randomUUID());
s.addDomainData(dd);
domainDataDAO.save(dd);
}
@@ -153,15 +159,16 @@ public class BaseSchedulerServiceImpl {
if (s.getScheduleApprovals() != null) {
for (ScheduleApproval scheduleApproval : s.getScheduleApprovals()) {
if (scheduleApproval.getUserId().equals(approvalMessage.getApprovalUserId())
- && scheduleApproval.getApprovalTypeId().equals(approvalType.getId())) {
+ && scheduleApproval.getApprovalTypesUuid().equals(approvalType.getUuid())) {
sa = scheduleApproval;
}
}
}
if (sa == null) {
sa = new ScheduleApproval();
+ sa.setUuid(UUID.randomUUID());
sa.setSchedule(s);
- sa.setApprovalTypeId(approvalType.getId());
+ sa.setApprovalTypesUuid(approvalType.getUuid());
sa.setUserId(approvalMessage.getApprovalUserId());
}
// Ignore what time is on the message
@@ -181,18 +188,18 @@ public class BaseSchedulerServiceImpl {
}
private boolean allApprovalsReceived(Schedule schedule, ScheduleApproval sa) {
- Map<Integer, Integer> requiredApprovalsByType = new HashMap<Integer, Integer>(); // Approval
+ Map<UUID, Integer> requiredApprovalsByType = new HashMap<>(); // Approval
// countdown
- Map<Integer, ApprovalType> approvalsByType = new HashMap<Integer, ApprovalType>(); // Just
+ Map<UUID, ApprovalType> approvalsByType = new HashMap<>(); // Just
// for
// logging
List<ApprovalType> approvalTypes = approvalTypeDAO.findByDomain(schedule.getDomain());
for (ApprovalType at : approvalTypes) {
- Integer type = at.getId();
+ UUID type = at.getUuid();
Integer count = at.getApprovalCount();
requiredApprovalsByType.put(type, count);
- approvalsByType.put(at.getId(), at);
+ approvalsByType.put(at.getUuid(), at);
}
// Account for approvals so far
@@ -205,17 +212,17 @@ public class BaseSchedulerServiceImpl {
}
for (ScheduleApproval approval : existingApprovals) {
if (approval.getStatus().equals(ApprovalStatusEnum.Accepted.toString())) {
- Integer remaining = requiredApprovalsByType.get(approval.getApprovalTypeId());
+ Integer remaining = requiredApprovalsByType.get(approval.getApprovalTypesUuid());
if (remaining != null) {
remaining = remaining - 1;
- requiredApprovalsByType.put(approval.getApprovalTypeId(), remaining);
+ requiredApprovalsByType.put(approval.getApprovalTypesUuid(), remaining);
} else {
- log.warn("Ignored Unidentified approval type {0} for domain {1}", approval.getApprovalTypeId(),
+ log.warn("Ignored Unidentified approval type {0} for domain {1}", approval.getApprovalTypesUuid(),
schedule.getDomain());
}
}
}
- for (Integer id : requiredApprovalsByType.keySet()) {
+ for (UUID id : requiredApprovalsByType.keySet()) {
Integer remaining = requiredApprovalsByType.get(id);
if (remaining > 0) {
return false;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizedScheduleService.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizedScheduleService.java
new file mode 100644
index 0000000..c0806d7
--- /dev/null
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizedScheduleService.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.onap.optf.cmso.service.rs;
+
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.onap.optf.cmso.common.CMSRequestError;
+import org.onap.optf.cmso.service.rs.models.v2.OptimizedScheduleMessage;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+
+@Api("CMSO Optimized Schedule API")
+@Path("/{apiVersion}")
+@Produces({MediaType.APPLICATION_JSON})
+public interface CMSOOptimizedScheduleService {
+
+ // ******************************************************************
+ @POST
+ @Path("/schedules/optimized/{scheduleId}")
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "", notes = "Creates a request for an optimized schedule")
+ @ApiResponses(
+ value = {@ApiResponse(code = 202, message = "Schedule request accepted for optimization."),
+ @ApiResponse(code = 409, message = "Schedule request already exists for this schedule id.",
+ response = CMSRequestError.class),
+ @ApiResponse(code = 500, message = "Unexpected Runtime error")})
+ public Response createScheduleRequest(
+ @ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
+ @ApiParam(
+ value = "Schedule id to uniquely identify the schedule request being created.") @PathParam("scheduleId") String scheduleId,
+ @ApiParam(
+ value = "Data for creating a schedule request for the given schedule id") OptimizedScheduleMessage scheduleMessage);
+
+
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizedScheduleServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizedScheduleServiceImpl.java
new file mode 100644
index 0000000..aa397ae
--- /dev/null
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizedScheduleServiceImpl.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright © 2017-2019 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.onap.optf.cmso.service.rs;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+
+import org.onap.observations.Observation;
+import org.onap.optf.cmso.common.LogMessages;
+import org.onap.optf.cmso.common.exceptions.CMSException;
+import org.onap.optf.cmso.eventq.CMSQueueJob;
+import org.onap.optf.cmso.model.dao.ChangeManagementChangeWindowDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementDetailDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementGroupDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
+import org.onap.optf.cmso.model.dao.ScheduleDAO;
+import org.onap.optf.cmso.model.dao.ScheduleQueryDAO;
+import org.onap.optf.cmso.service.rs.models.v2.OptimizedScheduleMessage;
+import org.onap.optf.cmso.ticketmgt.TmClient;
+import org.onap.optf.cmso.ticketmgt.bean.BuildCreateRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+@Controller
+public class CMSOOptimizedScheduleServiceImpl implements CMSOOptimizedScheduleService {
+ private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
+
+ @Autowired
+ CMSQueueJob qJob;
+
+ @Autowired
+ Environment env;
+
+ @Autowired
+ ChangeManagementScheduleDAO cmScheduleDAO;
+
+ @Autowired
+ ChangeManagementGroupDAO cmGroupDAO;
+
+ @Autowired
+ ChangeManagementChangeWindowDAO cmChangeWindowDAO;
+
+ @Autowired
+ ChangeManagementDetailDAO cmDetailsDAO;
+
+ @Autowired
+ ScheduleQueryDAO scheduleQueryDAO;
+
+ @Autowired
+ ScheduleDAO scheduleDAO;
+
+ @Autowired
+ TmClient tmClient;
+
+ @Autowired
+ BuildCreateRequest buildCreateRequest;
+
+
+ @Context
+ HttpServletRequest request;
+
+ @Override
+ @Transactional
+ public Response createScheduleRequest(String apiVersion, String scheduleId, OptimizedScheduleMessage scheduleMessage)
+ {
+ Observation.report(LogMessages.CREATE_SCHEDULE_REQUEST, "Received", request.getRemoteAddr(), scheduleId,
+ scheduleMessage.toString());
+ Response response = null;
+ try {
+ response = Response.accepted().build();
+// } catch (CMSException e) {
+// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+// Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
+// response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
+ } catch (Exception e) {
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ response = Response.serverError().build();
+ }
+ Observation.report(LogMessages.CREATE_SCHEDULE_REQUEST, "Returned", request.getRemoteAddr(), scheduleId,
+ response.getStatusInfo().toString());
+ return response;
+ }
+
+
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSCallbackImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizerCallbackImpl.java
index 5d11225..50d2ff2 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSCallbackImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOOptimizerCallbackImpl.java
@@ -1,260 +1,269 @@
-/*
- * Copyright © 2017-2019 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Unless otherwise specified, all documentation contained herein is licensed
- * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
- * you may not use this documentation except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://creativecommons.org/licenses/by/4.0/
- *
- * Unless required by applicable law or agreed to in writing, documentation
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-*/
-
-package org.onap.optf.cmso.service.rs;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
-import javax.transaction.Transactional;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriInfo;
-import org.joda.time.DateTime;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.ISODateTimeFormat;
-import org.onap.observations.Mdc;
-import org.onap.optf.cmso.common.CMSStatusEnum;
-import org.onap.optf.cmso.common.DomainsEnum;
-import org.onap.optf.cmso.common.LogMessages;
-import org.onap.optf.cmso.common.exceptions.CMSException;
-import org.onap.optf.cmso.common.exceptions.CMSNotFoundException;
-import org.onap.optf.cmso.model.ChangeManagementGroup;
-import org.onap.optf.cmso.model.ChangeManagementSchedule;
-import org.onap.optf.cmso.model.Schedule;
-import org.onap.optf.cmso.model.dao.ChangeManagementChangeWindowDAO;
-import org.onap.optf.cmso.model.dao.ChangeManagementDetailDAO;
-import org.onap.optf.cmso.model.dao.ChangeManagementGroupDAO;
-import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
-import org.onap.optf.cmso.optimizer.bean.CMOptimizerResponse;
-import org.onap.optf.cmso.optimizer.bean.CMSchedule;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@Controller
-public class CMSCallbackImpl extends BaseSchedulerServiceImpl implements CMSOptimizerCallback {
- private static EELFLogger log = EELFManager.getInstance().getLogger(CMSCallbackImpl.class);
- private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();
- private static EELFLogger audit = EELFManager.getInstance().getAuditLogger();
- private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
- private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
-
- @Autowired
- ChangeManagementScheduleDAO cmScheduleDAO;
-
- @Autowired
- ChangeManagementGroupDAO cmGroupDAO;
-
- @Autowired
- ChangeManagementChangeWindowDAO cmChangeWindowDAO;
-
- @Autowired
- ChangeManagementDetailDAO cmDetailsDAO;
-
- @Override
- @Transactional
- public Response sniroCallback(String apiVersion, CMOptimizerResponse sniroResponse, UriInfo uri,
- HttpServletRequest request) {
- Response response = null;
- log.info(LogMessages.PROCESS_OPTIMIZER_CALLBACK, "Received", request.getRemoteAddr(), "");
- log.info(LogMessages.OPTIMIZER_REQUEST, "Callback received", sniroResponse.getTransactionId(),
- uri.getAbsolutePath().toString());
- try {
- // Note that transaction ID and schedule ID are currently the same value.
-
- String transactionId = sniroResponse.getTransactionId();
-
- // Synchronize this with transaction that scheduled the SNIRO optimization
- // to ensure status updates are properly ordered.
- // This is necessary only in the race condition where SNIRO callback comes
- // before the SNIRO response is processed and the scheduling transaction is
- // still in flight.
- // Note that this may happen in loopback mode, but is not likely to happen with
- // real SNIRO unless SNIRO changes to be synchronous and the callback comes before
- // the response.
- // If this lock times out, the schedule will remain in 'Optimization In
- // Progress' and never complete.
- Schedule schedule = scheduleDAO.lockOneByTransactionId(transactionId);
-
- if (schedule == null) {
- throw new CMSNotFoundException(DomainsEnum.ChangeManagement.toString(),
- "(OptimizerTransactionID=" + transactionId + ")");
-
- }
- CMSStatusEnum status = CMSStatusEnum.PendingApproval.fromString(schedule.getStatus());
- debug.debug("Status at time of SNIRO callback is " + status.toString());
- switch (status) {
- // PendingSchedule may be a valid status in the cases where SNIRO async call
- // returns before
- // We have committed the OptimizationInProgress status
- // The dispatch logic ensures that we only every dispatch once.
- case OptimizationInProgress:
- processSniroResponse(sniroResponse, schedule);
- scheduleDAO.save(schedule);
- response = Response.ok().build();
- break;
- default:
- throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.OPTIMIZER_CALLBACK_STATE_ERROR,
- CMSStatusEnum.OptimizationInProgress.toString(), schedule.getStatus().toString());
- }
- } catch (CMSException e) {
- errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
- } catch (Exception e) {
- errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- response = Response.serverError().entity(e.getMessage()).build();
- } finally {
- }
- return response;
- }
-
- private void processSniroResponse(CMOptimizerResponse sniroResponse, Schedule schedule) {
- try {
- schedule.setOptimizerReturnDateTimeMillis(System.currentTimeMillis());
- schedule.setOptimizerStatus(sniroResponse.getRequestState());
- schedule.setOptimizerMessage(sniroResponse.getDescription());
- String scheduleId = sniroResponse.getScheduleId();
- ObjectMapper om = new ObjectMapper();
- CMSchedule[] scheduleArray = sniroResponse.getSchedule();
- if (scheduleArray != null && scheduleArray.length > 0) {
- String scheduleString = om.writeValueAsString(scheduleArray);
- schedule.setSchedule(scheduleString);
- log.debug("scheduleId={0} schedule={1}", scheduleId, scheduleString);
- for (CMSchedule sniroSchedule : sniroResponse.getSchedule()) {
- String groupId = sniroSchedule.getGroupId();
- DateTime finishTime = convertDate(sniroSchedule.getFinishTime(), "finishTime");
- DateTime latestInstanceStartTime =
- convertDate(sniroSchedule.getLatestInstanceStartTime(), "latestInstanceStartTime");
- DateTime startTime = convertDate(sniroSchedule.getStartTime(), "startTime");
- ChangeManagementGroup group = cmGroupDAO.findOneBySchedulesIDGroupID(schedule.getId(), groupId);
- if (group == null) {
- throw new CMSException(Status.PRECONDITION_FAILED,
- LogMessages.CHANGE_MANAGEMENT_GROUP_NOT_FOUND, schedule.getScheduleId(), groupId);
- }
- group.setStartTimeMillis(startTime.getMillis());
- group.setFinishTimeMillis(finishTime.getMillis());
- group.setLastInstanceStartTimeMillis(latestInstanceStartTime.getMillis());
- cmGroupDAO.save(group);
- long totalDuration =
- (group.getAdditionalDurationInSecs() + group.getNormalDurationInSecs()) * 1000l;
- Map<String, Map<String, Long>> startAndFinishTimeMap = new HashMap<String, Map<String, Long>>();
- makeMap(startTime.getMillis(), latestInstanceStartTime.getMillis(), group.getConcurrencyLimit(),
- totalDuration, sniroSchedule.getNode(), startAndFinishTimeMap);
- for (String node : sniroSchedule.getNode()) {
- processNode(schedule, group, node, startAndFinishTimeMap);
- }
- }
- schedule.setStatus(CMSStatusEnum.PendingApproval.toString());
- } else {
- debug.debug("scheduleId={0} schedule=null status={1} ", scheduleId, schedule.getOptimizerStatus());
- schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString());
- }
- } catch (CMSException e) {
- errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString());
- schedule.setOptimizerStatus(e.getStatus().toString());
- schedule.setOptimizerMessage(e.getLocalizedMessage());
- } catch (Exception e) {
- errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString());
- schedule.setOptimizerStatus("Exception");
- schedule.setOptimizerMessage(e.getLocalizedMessage());
- }
- }
-
- public static void makeMap(Long startTime, Long latestInstanceStartTime, int concurrencyLimit, long totalDuration,
- List<String> nodes, Map<String, Map<String, Long>> startAndFinishTimeMap) throws CMSException {
- Long nextStartTime = null;
- Long nextFinishTime = null;
- for (int nodeNumber = 0; nodeNumber < nodes.size(); nodeNumber++) {
- String node = nodes.get(nodeNumber);
- if (nodeNumber % concurrencyLimit == 0) {
- if (nodeNumber == 0)
- nextStartTime = startTime;
- else
- nextStartTime = nextStartTime + totalDuration;
- if (nextStartTime > latestInstanceStartTime) {
- throw new CMSException(Status.BAD_REQUEST, LogMessages.UNABLE_TO_ALLOCATE_VNF_TIMESLOTS,
- startTime.toString(), latestInstanceStartTime.toString(), String.valueOf(totalDuration),
- String.valueOf(concurrencyLimit), String.valueOf(nodes.size()));
- }
- nextFinishTime = nextStartTime + totalDuration;
- }
- Map<String, Long> map = new HashMap<String, Long>();
- map.put("startTime", nextStartTime);
- map.put("finishTime", nextFinishTime);
- startAndFinishTimeMap.put(node, map);
- }
-
- }
-
- private void processNode(Schedule schedule, ChangeManagementGroup group, String node,
- Map<String, Map<String, Long>> startAndFinishTimeMap) throws CMSException {
- Map<String, Long> map = startAndFinishTimeMap.get(node);
- ChangeManagementSchedule detail = cmScheduleDAO.findOneByGroupIDAndVnfName(group.getId(), node);
- if (detail == null) {
- throw new CMSException(Status.NOT_FOUND, LogMessages.UNABLE_TO_LOCATE_SCHEDULE_DETAIL,
- schedule.getScheduleId(), group.getGroupId(), node);
- }
- detail.setStartTimeMillis(map.get("startTime"));
- detail.setFinishTimeMillis(map.get("finishTime"));
- detail.setVnfId("");
- detail.setStatus(CMSStatusEnum.PendingApproval.toString());
- cmScheduleDAO.save(detail);
- }
-
- public static DateTime convertDate(String utcDate, String attrName) throws CMSException {
- try {
- DateTime dateTime = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss").withZoneUTC().parseDateTime(utcDate);
- if (dateTime != null)
- return dateTime;
- } catch (Exception e) {
- debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- }
- throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, attrName, utcDate);
- }
-
- public static DateTime convertISODate(String utcDate, String attrName) throws CMSException {
- try {
- DateTime dateTime = ISODateTimeFormat.dateTimeParser().parseDateTime(utcDate);
- if (dateTime != null)
- return dateTime;
- } catch (Exception e) {
- debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- }
- throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, attrName, utcDate);
- }
-
-}
+/*
+ * Copyright © 2017-2019 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.onap.optf.cmso.service.rs;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.transaction.Transactional;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.core.UriInfo;
+
+import org.joda.time.DateTime;
+import org.joda.time.format.DateTimeFormat;
+import org.joda.time.format.ISODateTimeFormat;
+import org.onap.optf.cmso.common.CMSStatusEnum;
+import org.onap.optf.cmso.common.DomainsEnum;
+import org.onap.optf.cmso.common.LogMessages;
+import org.onap.optf.cmso.common.exceptions.CMSException;
+import org.onap.optf.cmso.common.exceptions.CMSNotFoundException;
+import org.onap.optf.cmso.model.ChangeManagementGroup;
+import org.onap.optf.cmso.model.ChangeManagementSchedule;
+import org.onap.optf.cmso.model.Schedule;
+import org.onap.optf.cmso.model.dao.ChangeManagementChangeWindowDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementDetailDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementGroupDAO;
+import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;
+import org.onap.optf.cmso.optimizer.bean.CMOptimizerResponse;
+import org.onap.optf.cmso.optimizer.bean.CMSchedule;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+public class CMSOOptimizerCallbackImpl extends BaseSchedulerServiceImpl implements CMSOptimizerCallback {
+ private static EELFLogger log = EELFManager.getInstance().getLogger(CMSOOptimizerCallbackImpl.class);
+ private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();
+ private static EELFLogger audit = EELFManager.getInstance().getAuditLogger();
+ private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
+ private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
+
+ @Context
+ UriInfo uri;
+
+ @Context
+ HttpServletRequest request;
+
+
+ @Autowired
+ ChangeManagementScheduleDAO cmScheduleDAO;
+
+ @Autowired
+ ChangeManagementGroupDAO cmGroupDAO;
+
+ @Autowired
+ ChangeManagementChangeWindowDAO cmChangeWindowDAO;
+
+ @Autowired
+ ChangeManagementDetailDAO cmDetailsDAO;
+
+ @Override
+ @Transactional
+ public Response sniroCallback(String apiVersion, CMOptimizerResponse sniroResponse) {
+ Response response = null;
+ log.info(LogMessages.PROCESS_OPTIMIZER_CALLBACK, "Received", request.getRemoteAddr(), "");
+ log.info(LogMessages.OPTIMIZER_REQUEST, "Callback received", sniroResponse.getTransactionId(),
+ uri.getAbsolutePath().toString());
+ try {
+ // Note that transaction ID and schedule ID are currently the same value.
+
+ String transactionId = sniroResponse.getTransactionId();
+
+ // Synchronize this with transaction that scheduled the SNIRO optimization
+ // to ensure status updates are properly ordered.
+ // This is necessary only in the race condition where SNIRO callback comes
+ // before the SNIRO response is processed and the scheduling transaction is
+ // still in flight.
+ // Note that this may happen in loopback mode, but is not likely to happen with
+ // real SNIRO unless SNIRO changes to be synchronous and the callback comes before
+ // the response.
+ // If this lock times out, the schedule will remain in 'Optimization In
+ // Progress' and never complete.
+ Schedule schedule = scheduleDAO.lockOneByTransactionId(transactionId);
+
+ if (schedule == null) {
+ throw new CMSNotFoundException(DomainsEnum.ChangeManagement.toString(),
+ "(OptimizerTransactionID=" + transactionId + ")");
+
+ }
+ CMSStatusEnum status = CMSStatusEnum.PendingApproval.fromString(schedule.getStatus());
+ debug.debug("Status at time of SNIRO callback is " + status.toString());
+ switch (status) {
+ // PendingSchedule may be a valid status in the cases where SNIRO async call
+ // returns before
+ // We have committed the OptimizationInProgress status
+ // The dispatch logic ensures that we only every dispatch once.
+ case OptimizationInProgress:
+ processSniroResponse(sniroResponse, schedule);
+ scheduleDAO.save(schedule);
+ response = Response.ok().build();
+ break;
+ default:
+ throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.OPTIMIZER_CALLBACK_STATE_ERROR,
+ CMSStatusEnum.OptimizationInProgress.toString(), schedule.getStatus().toString());
+ }
+ } catch (CMSException e) {
+ errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
+ } catch (Exception e) {
+ errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ response = Response.serverError().entity(e.getMessage()).build();
+ } finally {
+ }
+ return response;
+ }
+
+ private void processSniroResponse(CMOptimizerResponse sniroResponse, Schedule schedule) {
+ try {
+ schedule.setOptimizerReturnDateTimeMillis(System.currentTimeMillis());
+ schedule.setOptimizerStatus(sniroResponse.getRequestState());
+ schedule.setOptimizerMessage(sniroResponse.getDescription());
+ String scheduleId = sniroResponse.getScheduleId();
+ ObjectMapper om = new ObjectMapper();
+ CMSchedule[] scheduleArray = sniroResponse.getSchedule();
+ if (scheduleArray != null && scheduleArray.length > 0) {
+ String scheduleString = om.writeValueAsString(scheduleArray);
+ schedule.setSchedule(scheduleString);
+ log.debug("scheduleId={0} schedule={1}", scheduleId, scheduleString);
+ for (CMSchedule sniroSchedule : sniroResponse.getSchedule()) {
+ String groupId = sniroSchedule.getGroupId();
+ DateTime finishTime = convertDate(sniroSchedule.getFinishTime(), "finishTime");
+ DateTime latestInstanceStartTime =
+ convertDate(sniroSchedule.getLatestInstanceStartTime(), "latestInstanceStartTime");
+ DateTime startTime = convertDate(sniroSchedule.getStartTime(), "startTime");
+ ChangeManagementGroup group = cmGroupDAO.findOneBySchedulesIDGroupID(schedule.getUuid(), groupId);
+ if (group == null) {
+ throw new CMSException(Status.PRECONDITION_FAILED,
+ LogMessages.CHANGE_MANAGEMENT_GROUP_NOT_FOUND, schedule.getScheduleId(), groupId);
+ }
+ group.setStartTimeMillis(startTime.getMillis());
+ group.setFinishTimeMillis(finishTime.getMillis());
+ group.setLastInstanceStartTimeMillis(latestInstanceStartTime.getMillis());
+ cmGroupDAO.save(group);
+ long totalDuration =
+ (group.getAdditionalDurationInSecs() + group.getNormalDurationInSecs()) * 1000l;
+ Map<String, Map<String, Long>> startAndFinishTimeMap = new HashMap<String, Map<String, Long>>();
+ makeMap(startTime.getMillis(), latestInstanceStartTime.getMillis(), group.getConcurrencyLimit(),
+ totalDuration, sniroSchedule.getNode(), startAndFinishTimeMap);
+ for (String node : sniroSchedule.getNode()) {
+ processNode(schedule, group, node, startAndFinishTimeMap);
+ }
+ }
+ schedule.setStatus(CMSStatusEnum.PendingApproval.toString());
+ } else {
+ debug.debug("scheduleId={0} schedule=null status={1} ", scheduleId, schedule.getOptimizerStatus());
+ schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString());
+ }
+ } catch (CMSException e) {
+ errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString());
+ schedule.setOptimizerStatus(e.getStatus().toString());
+ schedule.setOptimizerMessage(e.getLocalizedMessage());
+ } catch (Exception e) {
+ errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString());
+ schedule.setOptimizerStatus("Exception");
+ schedule.setOptimizerMessage(e.getLocalizedMessage());
+ }
+ }
+
+ public static void makeMap(Long startTime, Long latestInstanceStartTime, int concurrencyLimit, long totalDuration,
+ List<String> nodes, Map<String, Map<String, Long>> startAndFinishTimeMap) throws CMSException {
+ Long nextStartTime = null;
+ Long nextFinishTime = null;
+ for (int nodeNumber = 0; nodeNumber < nodes.size(); nodeNumber++) {
+ String node = nodes.get(nodeNumber);
+ if (nodeNumber % concurrencyLimit == 0) {
+ if (nodeNumber == 0)
+ nextStartTime = startTime;
+ else
+ nextStartTime = nextStartTime + totalDuration;
+ if (nextStartTime > latestInstanceStartTime) {
+ throw new CMSException(Status.BAD_REQUEST, LogMessages.UNABLE_TO_ALLOCATE_VNF_TIMESLOTS,
+ startTime.toString(), latestInstanceStartTime.toString(), String.valueOf(totalDuration),
+ String.valueOf(concurrencyLimit), String.valueOf(nodes.size()));
+ }
+ nextFinishTime = nextStartTime + totalDuration;
+ }
+ Map<String, Long> map = new HashMap<String, Long>();
+ map.put("startTime", nextStartTime);
+ map.put("finishTime", nextFinishTime);
+ startAndFinishTimeMap.put(node, map);
+ }
+
+ }
+
+ private void processNode(Schedule schedule, ChangeManagementGroup group, String node,
+ Map<String, Map<String, Long>> startAndFinishTimeMap) throws CMSException {
+ Map<String, Long> map = startAndFinishTimeMap.get(node);
+ ChangeManagementSchedule detail = cmScheduleDAO.findOneByGroupIDAndVnfName(group.getUuid(), node);
+ if (detail == null) {
+ throw new CMSException(Status.NOT_FOUND, LogMessages.UNABLE_TO_LOCATE_SCHEDULE_DETAIL,
+ schedule.getScheduleId(), group.getGroupId(), node);
+ }
+ detail.setStartTimeMillis(map.get("startTime"));
+ detail.setFinishTimeMillis(map.get("finishTime"));
+ detail.setVnfId("");
+ detail.setStatus(CMSStatusEnum.PendingApproval.toString());
+ cmScheduleDAO.save(detail);
+ }
+
+ public static DateTime convertDate(String utcDate, String attrName) throws CMSException {
+ try {
+ DateTime dateTime = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss").withZoneUTC().parseDateTime(utcDate);
+ if (dateTime != null)
+ return dateTime;
+ } catch (Exception e) {
+ debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ }
+ throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, attrName, utcDate);
+ }
+
+ public static DateTime convertISODate(String utcDate, String attrName) throws CMSException {
+ try {
+ DateTime dateTime = ISODateTimeFormat.dateTimeParser().parseDateTime(utcDate);
+ if (dateTime != null)
+ return dateTime;
+ } catch (Exception e) {
+ debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ }
+ throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, attrName, utcDate);
+ }
+
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOService.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOService.java
index 97bb78e..6e99b0d 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOService.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOService.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@ import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
-@Api
+@Api("CMSO Schedule API")
@Path("/{apiVersion}")
@Produces({MediaType.APPLICATION_JSON})
public interface CMSOService {
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOServiceImpl.java
index c3d61da..cc304db 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOServiceImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOServiceImpl.java
@@ -39,6 +39,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
+import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.MultivaluedMap;
@@ -143,15 +144,15 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
}
Iterator<ScheduleQuery> iter = list.iterator();
while (iter.hasNext()) {
- Schedule s = scheduleDAO.findById(iter.next().getId()).orElse(null);
+ Schedule s = scheduleDAO.findById(iter.next().getUuid()).orElse(null);
if (s != null) {
schedules.add(s);
if (includeDetails) {
- List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(s.getId());
+ List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(s.getUuid());
s.setGroups(groups);
for (ChangeManagementGroup g : groups) {
List<ChangeManagementSchedule> cmSchedules =
- cmScheduleDAO.findByChangeManagementGroupId(g.getId());
+ cmScheduleDAO.findByChangeManagementGroupId(g.getUuid());
g.setChangeManagementSchedules(cmSchedules);
}
}
@@ -261,8 +262,8 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
if (cw.getEndTime() == null || cw.getEndTime().equals(""))
throw new CMSException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE,
"endTime");
- DateTime start = CMSCallbackImpl.convertISODate(cw.getStartTime(), "startTime");
- DateTime end = CMSCallbackImpl.convertISODate(cw.getEndTime(), "endTime");
+ DateTime start = CMSOOptimizerCallbackImpl.convertISODate(cw.getStartTime(), "startTime");
+ DateTime end = CMSOOptimizerCallbackImpl.convertISODate(cw.getEndTime(), "endTime");
if (!end.isAfter(start))
throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_CHANGE_WINDOW,
cw.getStartTime(), cw.getEndTime());
@@ -300,7 +301,8 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
CMSInfo schedulingInfo = scheduleMessage.getSchedulingInfo();
for (VnfDetailsMessage vnfDetail : schedulingInfo.getVnfDetails()) {
ChangeManagementGroup cmg = new ChangeManagementGroup();
- cmg.setSchedulesId(schedule.getId());
+ cmg.setUuid(UUID.randomUUID());
+ cmg.setSchedulesUuid(schedule.getUuid());
cmg.setGroupId("");
if (vnfDetail.getGroupId() != null)
cmg.setGroupId(vnfDetail.getGroupId());
@@ -311,9 +313,10 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
cmGroupDAO.save(cmg);
for (ChangeWindowMessage cw : vnfDetail.getChangeWindow()) {
ChangeManagementChangeWindow cmcw = new ChangeManagementChangeWindow();
- cmcw.setChangeManagementGroupsId(cmg.getId());
- DateTime start = CMSCallbackImpl.convertISODate(cw.getStartTime(), "startTime");
- DateTime end = CMSCallbackImpl.convertISODate(cw.getEndTime(), "startTime");
+ cmcw.setUuid(UUID.randomUUID());
+ cmcw.setChangeManagementGroupUuid(cmg.getUuid());
+ DateTime start = CMSOOptimizerCallbackImpl.convertISODate(cw.getStartTime(), "startTime");
+ DateTime end = CMSOOptimizerCallbackImpl.convertISODate(cw.getEndTime(), "startTime");
cmcw.setStartTimeMillis(start.getMillis());
cmcw.setFinishTimeMillis(end.getMillis());
cmChangeWindowDAO.save(cmcw);
@@ -321,7 +324,8 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
for (String vnf : vnfDetail.getNode()) {
ChangeManagementSchedule cms = new ChangeManagementSchedule();
- cms.setChangeManagementGroupsId(cmg.getId());
+ cms.setUuid(UUID.randomUUID());
+ cms.setChangeManagementGroupUuid(cmg.getUuid());
cms.setVnfName(vnf);
cms.setStatus(CMSStatusEnum.PendingSchedule.toString());
cmScheduleDAO.save(cms);
@@ -333,7 +337,8 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
CMSInfo schedulingInfo = scheduleMessage.getSchedulingInfo();
for (VnfDetailsMessage vnfDetail : schedulingInfo.getVnfDetails()) {
ChangeManagementGroup cmg = new ChangeManagementGroup();
- cmg.setSchedulesId(schedule.getId());
+ cmg.setUuid(UUID.randomUUID());
+ cmg.setSchedulesUuid(schedule.getUuid());
cmg.setGroupId("");
int duration = schedulingInfo.getNormalDurationInSeconds();
int backout = schedulingInfo.getAdditionalDurationInSeconds();
@@ -346,20 +351,22 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
cmGroupDAO.save(cmg);
for (String vnf : vnfDetail.getNode()) {
ChangeManagementSchedule cms = new ChangeManagementSchedule();
- cms.setChangeManagementGroupsId(cmg.getId());
+ cms.setUuid(UUID.randomUUID());
+ cms.setChangeManagementGroupUuid(cmg.getUuid());
cms.setVnfName(vnf);
cms.setStatus(CMSStatusEnum.PendingApproval.toString());
cmScheduleDAO.save(cms);
}
schedule.setStatus(CMSStatusEnum.PendingApproval.toString());
+ scheduleDAO.save(schedule);
}
}
private void deleteChangeManagement(Schedule schedule) throws CMSException {
- List<ChangeManagementGroup> cmgs = cmGroupDAO.findBySchedulesID(schedule.getId());
+ List<ChangeManagementGroup> cmgs = cmGroupDAO.findBySchedulesID(schedule.getUuid());
for (ChangeManagementGroup cmg : cmgs) {
- List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(cmg.getId());
+ List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(cmg.getUuid());
for (ChangeManagementSchedule s : schedules) {
CMSStatusEnum currentState = CMSStatusEnum.Completed.fromString(s.getStatus());
switch (currentState) {
@@ -494,7 +501,7 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
private void processApproveScheduleRequest(Schedule s, ApprovalMessage approval, List<DomainData> domainData)
throws CMSException {
- s = scheduleDAO.lockOne(s.getId());
+ s = scheduleDAO.lockOne(s.getUuid());
String domain = DomainsEnum.ChangeManagement.toString();
processApproval(s, domain, approval);
if (s.getStatus().equals(CMSStatusEnum.Accepted.toString())) {
@@ -510,10 +517,10 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
Integer max_vnfs_per_ticket = env.getProperty("tm.vnfs.per.ticket", Integer.class, 1);
- List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(s.getId());
+ List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(s.getUuid());
for (ChangeManagementGroup group : groups) {
- List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(group.getId());
+ List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(group.getUuid());
List<List<ChangeManagementSchedule>> ticketList = new ArrayList<List<ChangeManagementSchedule>>();
List<ChangeManagementSchedule> current = null;
for (ChangeManagementSchedule cms : schedules) {
@@ -560,9 +567,9 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
private void updateChangeManagementSchedules(Schedule s, CMSStatusEnum approvalrejected) {
debug.debug("Entered updateChangeManagementSchedules");
- List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(s.getId());
+ List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(s.getUuid());
for (ChangeManagementGroup group : groups) {
- List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(group.getId());
+ List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(group.getUuid());
for (ChangeManagementSchedule schedule : schedules) {
schedule.setStatus(approvalrejected.toString());
cmScheduleDAO.save(schedule);
@@ -603,7 +610,7 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
DomainsEnum.ChangeManagement.toString(), scheduleId);
}
Iterator<ChangeManagementDetail> iter = list.iterator();
- Map<Integer, Schedule> scheduleMap = new HashMap<Integer, Schedule>();
+ Map<UUID, Schedule> scheduleMap = new HashMap<UUID, Schedule>();
while (iter.hasNext()) {
ChangeManagementDetail cms = iter.next();
CmDetailsMessage msg = buildResponse(cms, scheduleMap);
@@ -636,7 +643,7 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
}
- private CmDetailsMessage buildResponse(ChangeManagementDetail cms, Map<Integer, Schedule> scheduleMap) {
+ private CmDetailsMessage buildResponse(ChangeManagementDetail cms, Map<UUID, Schedule> scheduleMap) {
CmDetailsMessage msg = new CmDetailsMessage();
msg.setVnfId(cms.getVnfId());
msg.setVnfName(cms.getVnfName());
@@ -656,17 +663,17 @@ public class CMSOServiceImpl extends BaseSchedulerServiceImpl implements CMSOSer
msg.setMsoRequestId(cms.getMsoRequestId());
msg.setMsoStatus(cms.getMsoStatus());
msg.setMsoTimeMillis(cms.getMsoTimeMillis());
- if (!scheduleMap.containsKey(cms.getSchedulesId())) {
- Schedule schedule = scheduleDAO.findById(cms.getSchedulesId()).orElse(null);
+ if (!scheduleMap.containsKey(cms.getSchedulesUuid())) {
+ Schedule schedule = scheduleDAO.findById(cms.getSchedulesUuid()).orElse(null);
if (schedule != null) {
// DO not innclude in the results
schedule.setScheduleInfo(null);
// schedule.setSchedule(null);
- scheduleMap.put(cms.getSchedulesId(), schedule);
+ scheduleMap.put(cms.getSchedulesUuid(), schedule);
}
}
- if (scheduleMap.containsKey(cms.getSchedulesId())) {
- msg.setScheduleRequest(scheduleMap.get(cms.getSchedulesId()));
+ if (scheduleMap.containsKey(cms.getSchedulesUuid())) {
+ msg.setScheduleRequest(scheduleMap.get(cms.getSchedulesUuid()));
}
return msg;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOptimizerCallback.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOptimizerCallback.java
index 99b4970..cc2785e 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOptimizerCallback.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CMSOptimizerCallback.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,24 +31,23 @@
package org.onap.optf.cmso.service.rs;
-import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
+
import org.onap.optf.cmso.optimizer.bean.CMOptimizerResponse;
+
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
-@Api
+@Api("CMSO Optimized Schedule API")
@Path("/{apiVersion}")
@Produces({MediaType.APPLICATION_JSON})
public interface CMSOptimizerCallback {
@@ -62,7 +61,6 @@ public interface CMSOptimizerCallback {
@ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)})
public Response sniroCallback(
@ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
- @ApiParam(value = "Return schedules > lastScheduleId") CMOptimizerResponse reponse, @Context UriInfo uri,
- @Context HttpServletRequest request);
+ @ApiParam(value = "Return schedules > lastScheduleId") CMOptimizerResponse reponse);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java
index 1a9c29d..9877d33 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,188 +43,180 @@ import org.onap.optf.cmso.model.DomainData;
public class CmQueryParameters {
- public enum QueryColumns {
- RequestScheduleId("request.scheduleId", String.class, "ss.schedule_id"), RequestScheduleName(
- "request.scheduleName", String.class,
- "ss.schedule_name"), RequestUserId("request.userId", String.class, "ss.user_id"), RequestStatus(
- "request.status", String.class, "ss.status"), RequestCreateDateTime("request.createDateTime",
- Date.class, "ss.create_date_time"), RequestOptimizerStatus("request.optimizerStatus",
- String.class, "ss.optimizer_status"), RequestApprovalUserId(
- "request.approvalUserId", String.class,
- "sa.user_id"), RequestApprovalStatus("request.approvalStatus",
- String.class, "sa.status"), RequestApprovalType(
- "request.approvalType", String.class,
- "at.approval_type"), WorkflowName("WorkflowName",
- DomainData.class,
- "dd.value"), vnfName("vnfName", String.class,
- "s.vnf_name"), vnfId("vnfId",
- String.class,
- "s.vnf_id"), vnfStatus(
- "vnfStatus",
- String.class,
- "s.vnf_status"),
- // vnfScheduleId("vnfScheduleId", String.class, "s.id"),
- startTime("startTime", Date.class, "s.start_time"), finishTime("finishTime", Date.class,
- "s.finish_ime"), lastInstanceTime("lastInstanceTime", Date.class, "g.last_instance_time"), tmChangeId(
- "tmChangeId", String.class, "s.tm_change_id"), concurrenyLimit("request.concurrencyLimit",
- Integer.class, "g.concurrency_limit"),
- // approvalUserId("approvalUserId", String.class, "approvalUserId"),
- // approvalStatus("approvalStatus", String.class, "approvalStatus"),
- // approvalType("approvalType", String.class, "approvalType"),
- ;
+ public enum QueryColumns {
+ RequestScheduleId("request.scheduleId", String.class, "ss.schedule_id"),
+ RequestScheduleName("request.scheduleName", String.class, "ss.schedule_name"),
+ RequestUserId("request.userId", String.class, "ss.user_id"),
+ RequestStatus("request.status", String.class, "ss.status"),
+ RequestCreateDateTime("request.createDateTime", Date.class, "ss.create_date_time"),
+ RequestOptimizerStatus("request.optimizerStatus", String.class, "ss.optimizer_status"),
+ RequestApprovalUserId("request.approvalUserId", String.class, "sa.user_id"),
+ RequestApprovalStatus("request.approvalStatus", String.class, "sa.status"),
+ RequestApprovalType("request.approvalType", String.class, "at.approval_type"),
+ WorkflowName("WorkflowName", DomainData.class, "dd.value"), vnfName("vnfName", String.class, "s.vnf_name"),
+ vnfId("vnfId", String.class, "s.vnf_id"), vnfStatus("vnfStatus", String.class, "s.vnf_status"),
+ // vnfScheduleId("vnfScheduleId", String.class, "s.id"),
+ startTime("startTime", Date.class, "s.start_time"), finishTime("finishTime", Date.class, "s.finish_ime"),
+ lastInstanceTime("lastInstanceTime", Date.class, "g.last_instance_time"),
+ tmChangeId("tmChangeId", String.class, "s.tm_change_id"),
+ concurrenyLimit("request.concurrencyLimit", Integer.class, "g.concurrency_limit"),
+ // approvalUserId("approvalUserId", String.class, "approvalUserId"),
+ // approvalStatus("approvalStatus", String.class, "approvalStatus"),
+ // approvalType("approvalType", String.class, "approvalType"),
+ ;
- private final String urlName;
- private final Class<?> type;
- private final String col;
+ private final String urlName;
+ private final Class<?> type;
+ private final String col;
- private QueryColumns(String urlName, Class<?> type, String col) {
- this.urlName = urlName;
- this.type = type;
- this.col = col;
- }
+ private QueryColumns(String urlName, Class<?> type, String col) {
+ this.urlName = urlName;
+ this.type = type;
+ this.col = col;
+ }
- }
+ }
- public static QueryColumns getQueryColumn(String urlName) {
- for (QueryColumns qc : QueryColumns.values()) {
- if (qc.urlName.equals(urlName))
- return qc;
- }
- return null;
- }
+ public static QueryColumns getQueryColumn(String urlName) {
+ for (QueryColumns qc : QueryColumns.values()) {
+ if (qc.urlName.equals(urlName))
+ return qc;
+ }
+ return null;
+ }
- public static String buildClause(String urlName, List<String> values) throws CMSException {
- QueryColumns qc = getQueryColumn(urlName);
- if (qc == null) {
- throw new CMSException(Status.BAD_REQUEST, LogMessages.UNDEFINED_FILTER_ATTRIBUTE, urlName);
- }
- if (qc.type == Date.class) {
- return formatDate(urlName, values, qc);
- }
- if (qc.type == DomainData.class) {
- return formatDomainData(urlName, values, qc);
- }
- return formatString(urlName, values, qc);
- }
+ public static String buildClause(String urlName, List<String> values) throws CMSException {
+ QueryColumns qc = getQueryColumn(urlName);
+ if (qc == null) {
+ throw new CMSException(Status.BAD_REQUEST, LogMessages.UNDEFINED_FILTER_ATTRIBUTE, urlName);
+ }
+ if (qc.type == Date.class) {
+ return formatDate(urlName, values, qc);
+ }
+ if (qc.type == DomainData.class) {
+ return formatDomainData(urlName, values, qc);
+ }
+ return formatString(urlName, values, qc);
+ }
- private static String formatString(String urlName, List<String> values, QueryColumns qc) {
- StringBuilder clause = new StringBuilder();
- List<String> likes = new ArrayList<String>();
- List<String> in = new ArrayList<String>();
- for (String value : values) {
- if (value.contains("%"))
- likes.add(value);
- else
- in.add(value);
- }
- String delim = "(";
- if (in.size() > 0) {
- clause.append(delim).append(qc.col).append(" in ('");
- String inDelim = "";
- for (String value : in) {
- clause.append(inDelim).append(value).append("'");
- inDelim = ", '";
- }
- clause.append(") ");
- delim = " OR ";
- }
- if (likes.size() > 0) {
- for (String value : likes) {
- clause.append(delim).append(qc.col).append(" like '").append(value).append("'");
- delim = " OR ";
- }
- }
- if (!delim.equals("("))
- clause.append(")");
- return clause.toString();
- }
+ private static String formatString(String urlName, List<String> values, QueryColumns qc) {
+ StringBuilder clause = new StringBuilder();
+ List<String> likes = new ArrayList<String>();
+ List<String> in = new ArrayList<String>();
+ for (String value : values) {
+ if (value.contains("%"))
+ likes.add(value);
+ else
+ in.add(value);
+ }
+ String delim = "(";
+ if (in.size() > 0) {
+ clause.append(delim).append(qc.col).append(" in ('");
+ String inDelim = "";
+ for (String value : in) {
+ clause.append(inDelim).append(value).append("'");
+ inDelim = ", '";
+ }
+ clause.append(") ");
+ delim = " OR ";
+ }
+ if (likes.size() > 0) {
+ for (String value : likes) {
+ clause.append(delim).append(qc.col).append(" like '").append(value).append("'");
+ delim = " OR ";
+ }
+ }
+ if (!delim.equals("("))
+ clause.append(")");
+ return clause.toString();
+ }
- private static String formatDomainData(String urlName, List<String> values, QueryColumns qc) {
- StringBuilder clause = new StringBuilder();
- String delim = "(";
- if (values.size() > 0) {
- for (String value : values) {
- clause.append(delim).append(" (dd.name = '").append(qc.urlName).append("' AND dd.value = '")
- .append(value).append("')");
- delim = " OR ";
- }
- }
- if (!delim.equals("("))
- clause.append(")");
- return clause.toString();
- }
+ private static String formatDomainData(String urlName, List<String> values, QueryColumns qc) {
+ StringBuilder clause = new StringBuilder();
+ String delim = "(";
+ if (values.size() > 0) {
+ for (String value : values) {
+ clause.append(delim).append(" (dd.name = '").append(qc.urlName).append("' AND dd.value = '")
+ .append(value).append("')");
+ delim = " OR ";
+ }
+ }
+ if (!delim.equals("("))
+ clause.append(")");
+ return clause.toString();
+ }
- private static String formatDate(String urlName, List<String> values, QueryColumns qc) throws CMSException {
- List<String> clauses = new ArrayList<String>();
- for (String value : values) {
- String dates[] = value.split(",");
- switch (dates.length) {
- case 2:
- formatDatePair(qc, dates[0].trim(), dates[1].trim(), clauses);
- break;
- case 1:
- formatDatePair(qc, dates[0].trim(), "", clauses);
- break;
- default:
- throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, value);
- }
- }
- StringBuilder clause = new StringBuilder();
- String delim = "(";
- for (String c : clauses) {
- clause.append(delim).append(c);
- delim = " OR ";
- }
- if (!delim.equals(")")) {
- clause.append(")");
- }
- return clause.toString();
- }
+ private static String formatDate(String urlName, List<String> values, QueryColumns qc) throws CMSException {
+ List<String> clauses = new ArrayList<String>();
+ for (String value : values) {
+ String dates[] = value.split(",");
+ switch (dates.length) {
+ case 2:
+ formatDatePair(qc, dates[0].trim(), dates[1].trim(), clauses);
+ break;
+ case 1:
+ formatDatePair(qc, dates[0].trim(), "", clauses);
+ break;
+ default:
+ throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, value);
+ }
+ }
+ StringBuilder clause = new StringBuilder();
+ String delim = "(";
+ for (String c : clauses) {
+ clause.append(delim).append(c);
+ delim = " OR ";
+ }
+ if (!delim.equals(")")) {
+ clause.append(")");
+ }
+ return clause.toString();
+ }
- private static void formatDatePair(QueryColumns qc, String lowDate, String highDate, List<String> clauses)
- throws CMSException {
- StringBuilder clause = new StringBuilder();
- DateTime date1 = null;
- DateTime date2 = null;
- if (!lowDate.equals(""))
- date1 = convertDate(lowDate, qc.urlName);
- if (!highDate.equals(""))
- date2 = convertDate(highDate, qc.urlName);
- String delim = "(";
- if (date1 != null) {
- clause.append(delim).append(qc.col).append(" >= ").append(date1.getMillis());
- delim = " AND ";
- }
- if (date2 != null) {
- clause.append(delim).append(qc.col).append(" <= ").append(date2.getMillis());
- delim = " AND ";
- }
- if (!delim.equals(")")) {
- clause.append(")\n");
- clauses.add(clause.toString());
- }
- }
+ private static void formatDatePair(QueryColumns qc, String lowDate, String highDate, List<String> clauses)
+ throws CMSException {
+ StringBuilder clause = new StringBuilder();
+ DateTime date1 = null;
+ DateTime date2 = null;
+ if (!lowDate.equals(""))
+ date1 = convertDate(lowDate, qc.urlName);
+ if (!highDate.equals(""))
+ date2 = convertDate(highDate, qc.urlName);
+ String delim = "(";
+ if (date1 != null) {
+ clause.append(delim).append(qc.col).append(" >= ").append(date1.getMillis());
+ delim = " AND ";
+ }
+ if (date2 != null) {
+ clause.append(delim).append(qc.col).append(" <= ").append(date2.getMillis());
+ delim = " AND ";
+ }
+ if (!delim.equals(")")) {
+ clause.append(")\n");
+ clauses.add(clause.toString());
+ }
+ }
- private static DateTime convertDate(String utcDate, String urlName) throws CMSException {
- DateTime dateTime = ISODateTimeFormat.dateTimeParser().parseDateTime(utcDate);
- if (dateTime != null)
- return dateTime;
- throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, utcDate);
- }
+ private static DateTime convertDate(String utcDate, String urlName) throws CMSException {
+ DateTime dateTime = ISODateTimeFormat.dateTimeParser().parseDateTime(utcDate);
+ if (dateTime != null)
+ return dateTime;
+ throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, utcDate);
+ }
- // public static void main(String argv[])
- // {
- // List<String> values = new ArrayList<String>();
- // values.add("2017-07-08T11:12:13Z,2017-07-08T11:12:13Z");
- // values.add("2017-07-09T11:12:13Z,2017-07-09T11:12:13Z");
- // values.add(",2017-07-09T11:12:13Z");
- // values.add(" 2017-07-09T11:12:13Z");
- // try {
- // System.out.println(buildClause("request.createDateTime", values));
- // } catch (SchedulerException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
- //
- // }
+ // public static void main(String argv[])
+ // {
+ // List<String> values = new ArrayList<String>();
+ // values.add("2017-07-08T11:12:13Z,2017-07-08T11:12:13Z");
+ // values.add("2017-07-09T11:12:13Z,2017-07-09T11:12:13Z");
+ // values.add(",2017-07-09T11:12:13Z");
+ // values.add(" 2017-07-09T11:12:13Z");
+ // try {
+ // System.out.println(buildClause("request.createDateTime", values));
+ // } catch (SchedulerException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // }
+ //
+ // }
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheck.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheck.java
index edc2c96..fb69e31 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheck.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheck.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,25 +31,24 @@
package org.onap.optf.cmso.service.rs;
-import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
+
import org.onap.optf.cmso.service.rs.models.HealthCheckMessage;
+
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
-@Api
+@Api("CMSO Administration")
@Path("/{apiVersion}")
@Produces({MediaType.APPLICATION_JSON})
public interface HealthCheck {
@@ -63,7 +62,7 @@ public interface HealthCheck {
@ApiResponse(code = 400, message = "Not healthy", response = HealthCheckMessage.class)})
public Response healthCheck(@ApiParam(value = "v1") @PathParam("apiVersion") @DefaultValue("v1") String apiVersion,
@DefaultValue(value = "true") @ApiParam(value = "Check Interfaces",
- allowMultiple = true) @QueryParam("checkInterfaces") Boolean checkInterfaces,
- @Context UriInfo uri, @Context HttpServletRequest request);
+ allowMultiple = true) @QueryParam("checkInterfaces") Boolean checkInterfaces
+ );
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java
index 0877a6b..8e6b09e 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java
@@ -34,6 +34,7 @@ package org.onap.optf.cmso.service.rs;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
@@ -55,11 +56,17 @@ import com.att.eelf.configuration.EELFManager;
public class HealthCheckImpl implements HealthCheck {
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
+ @Context
+ UriInfo uri;
+
+ @Context
+ HttpServletRequest request;
+
@Autowired
TmClient tmClient;
@Autowired
- CMSOptimizerClient sniroClient;
+ CMSOptimizerClient optimizerClient;
@Autowired
ApprovalTypeDAO approvalTypeDAO;
@@ -71,7 +78,7 @@ public class HealthCheckImpl implements HealthCheck {
MsoStatusClient msoStatusClient;
@Override
- public Response healthCheck(String apiVersion, Boolean checkInterfaces, UriInfo uri, HttpServletRequest request) {
+ public Response healthCheck(String apiVersion, Boolean checkInterfaces) {
debug.debug("Entered healthcheck");
Response response = null;
HealthCheckMessage hc = new HealthCheckMessage();
@@ -80,7 +87,7 @@ public class HealthCheckImpl implements HealthCheck {
if (checkInterfaces) {
addToHealthCheckMessage(hc, tmClient.healthCheck());
addToHealthCheckMessage(hc, msoStatusClient.healthCheck());
- addToHealthCheckMessage(hc, sniroClient.healthCheck());
+ addToHealthCheckMessage(hc, optimizerClient.healthCheck());
}
addToHealthCheckMessage(hc, this.healthCheck());
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/ChangeWindow.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/ChangeWindow.java
new file mode 100644
index 0000000..7553c87
--- /dev/null
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/ChangeWindow.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.onap.optf.cmso.service.rs.models.v2;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.springframework.format.annotation.DateTimeFormat;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel(value = "Change Window",
+ description = "Time window for which tickets are to returned")
+public class ChangeWindow implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(ChangeWindow.class);
+
+ @ApiModelProperty(value = "Earliest time for which changes may begin.")
+ @DateTimeFormat(pattern="yyyy-MM-dd'T'hh:mm:ss'Z'")
+ private Date startTime;
+
+ @ApiModelProperty(value = "Latest time by which all changes must be completed.")
+ @DateTimeFormat(pattern="yyyy-MM-dd'T'hh:mm:ss'Z'")
+ private Date endTime;
+
+ public Date getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(Date startTime) {
+ this.startTime = startTime;
+ }
+
+ public Date getEndTime() {
+ return endTime;
+ }
+
+ public void setEndTime(Date endTime) {
+ this.endTime = endTime;
+ }
+
+ public String toString() {
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ return mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ log.debug("Error in toString()", e);
+ }
+ return "";
+ }
+
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/ElementInfo.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/ElementInfo.java
new file mode 100644
index 0000000..35649ea
--- /dev/null
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/ElementInfo.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ *
+ * Copyright © 2019 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.onap.optf.cmso.service.rs.models.v2;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel(value = "Optimizer Element", description = "Element to be scheduled.")
+public class ElementInfo implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(ElementInfo.class);
+
+ @ApiModelProperty(value = "Element identifier")
+ private String elementId;
+
+ @ApiModelProperty(value = "Implementation specific element data.")
+ public List<NameValue> elementData = new ArrayList<>();
+
+ @ApiModelProperty(value = "Request for be scheduled.")
+ public Object request;
+
+ public String getElementId() {
+ return elementId;
+ }
+
+ public void setElementId(String elementId) {
+ this.elementId = elementId;
+ }
+
+
+ public List<NameValue> getElementData() {
+ return elementData;
+ }
+
+ public void setElementData(List<NameValue> elementData) {
+ this.elementData = elementData;
+ }
+
+ public Object getRequest() {
+ return request;
+ }
+
+ public void setRequest(Object request) {
+ this.request = request;
+ }
+
+ public String toString() {
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ return mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ log.debug("Error in toString()", e);
+ }
+ return "";
+ }
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/NameValue.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/NameValue.java
new file mode 100644
index 0000000..9b71f76
--- /dev/null
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/NameValue.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright © 2017-2019 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.onap.optf.cmso.service.rs.models.v2;
+
+import java.io.Serializable;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel(value = "Name Value Data",
+ description = "Instance of a name/value")
+public class NameValue implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(NameValue.class);
+
+ public NameValue()
+ {
+
+ }
+
+ public NameValue(String name, Object value)
+ {
+ this.name = name;
+ this.value = value;
+ }
+
+ @ApiModelProperty(value = "Name.")
+ private String name;
+
+ @ApiModelProperty(value = "Value.")
+ private Object value;
+
+
+ public String getName() {
+ return name;
+ }
+
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+ public Object getValue() {
+ return value;
+ }
+
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+
+ public String toString() {
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ return mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ log.debug("Error in toString()", e);
+ }
+ return "";
+ }
+
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/OptimizedScheduleMessage.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/OptimizedScheduleMessage.java
new file mode 100644
index 0000000..797379c
--- /dev/null
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/OptimizedScheduleMessage.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.onap.optf.cmso.service.rs.models.v2;
+
+import java.io.Serializable;
+import java.util.List;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * The persistent class for the approval_types database table.
+ *
+ */
+@ApiModel(value = "Optimized Schedule Request", description = "Request to schedule VNF change management workflow(s).")
+public abstract class OptimizedScheduleMessage implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(OptimizedScheduleMessage.class);
+
+ // public abstract void setSchedulingInfo(Object schedulingInfo);
+
+ @ApiModelProperty(value = "Schedule domain : ChangeManagement")
+ private String domain;
+
+ @ApiModelProperty(value = "Schedule id that must be unique within the domain. Use of UUID is highly recommended.")
+ private String scheduleId;
+
+ @ApiModelProperty(value = "User provided name of the schedule (deaults to scheduleId")
+ private String scheduleName;
+
+ @ApiModelProperty(value = "ATTUID of the user requesting the schedule.")
+ private String userId;
+
+ @ApiModelProperty(value = "Implementation specific name value pairs.")
+ private List<NameValue> commonData;
+
+ @ApiModelProperty(value = "Scheduling data.")
+ private SchedulingData schedulingData;
+
+ public String getDomain() {
+ return domain;
+ }
+
+ public void setDomain(String domain) {
+ this.domain = domain;
+ }
+
+ public String getScheduleId() {
+ return scheduleId;
+ }
+
+ public void setScheduleId(String scheduleId) {
+ this.scheduleId = scheduleId;
+ }
+
+ public String getScheduleName() {
+ return scheduleName;
+ }
+
+ public void setScheduleName(String scheduleName) {
+ this.scheduleName = scheduleName;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public List<NameValue> getCommonData() {
+ return commonData;
+ }
+
+ public void setCommonData(List<NameValue> commonData) {
+ this.commonData = commonData;
+ }
+
+ public SchedulingData getSchedulingData() {
+ return schedulingData;
+ }
+
+ public void setSchedulingData(SchedulingData schedulingData) {
+ this.schedulingData = schedulingData;
+ }
+
+ public String toString() {
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ return mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ log.debug("Error in toString()", e);
+ }
+ return "";
+ }
+
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/PolicyInfo.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/PolicyInfo.java
new file mode 100644
index 0000000..c6a291c
--- /dev/null
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/PolicyInfo.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ *
+ * Copyright © 2019 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.onap.optf.cmso.service.rs.models.v2;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel(value = "Supported Policy Information", description = "Policy Information returned from get policies API.")
+public class PolicyInfo implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(PolicyInfo.class);
+
+ @ApiModelProperty(value = "Policy name")
+ private String policyName;
+
+ @ApiModelProperty(value = "Named values to modify/override policy attributes.")
+ public List<NameValue> policyModifiers = new ArrayList<>();
+
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
+
+
+ public List<NameValue> getPolicyModifiers() {
+ return policyModifiers;
+ }
+
+ public void setPolicyModifiers(List<NameValue> policyModifiers) {
+ this.policyModifiers = policyModifiers;
+ }
+
+ public String toString() {
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ return mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ log.debug("Error in toString()", e);
+ }
+ return "";
+ }
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/SchedulingData.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/SchedulingData.java
new file mode 100644
index 0000000..e17f1d2
--- /dev/null
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/v2/SchedulingData.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.onap.optf.cmso.service.rs.models.v2;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * The persistent class for the approval_types database table.
+ *
+ */
+@ApiModel(value = "Change Management Scheduling Info", description = "Details of schedule being requested")
+public class SchedulingData implements Serializable {
+ private static EELFLogger log = EELFManager.getInstance().getLogger(SchedulingData.class);
+
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "Expected duration (in seconds) of a successful execution of a single VNF change.")
+ private Integer normalDurationInSeconds;
+
+ @ApiModelProperty(value = "Additional duration (in seconds) to be added to support backout of an unsuccessful VNF change.")
+ private Integer additionalDurationInSeconds;
+
+ @ApiModelProperty(value = "Maximum number of VNF changes to schedule concurrently")
+ private Integer concurrencyLimit;
+
+ @ApiModelProperty(value = "Lists of desired change windows to schedule the elements.")
+ private List<ChangeWindow> changeWindows = new ArrayList<>();
+
+ @ApiModelProperty(value = "List of the policies to control optimization.")
+ private List<PolicyInfo> policies = new ArrayList<>();
+
+ @ApiModelProperty(value = "Lists of the VNFs to be changed and the desired change windows")
+ private List<ElementInfo> elements;
+
+ public String toString() {
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ return mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ log.debug("Error in toString()", e);
+ }
+ return "";
+ }
+
+ public Integer getNormalDurationInSeconds() {
+ return normalDurationInSeconds;
+ }
+
+ public void setNormalDurationInSeconds(Integer normalDurationInSeconds) {
+ this.normalDurationInSeconds = normalDurationInSeconds;
+ }
+
+ public Integer getAdditionalDurationInSeconds() {
+ return additionalDurationInSeconds;
+ }
+
+ public void setAdditionalDurationInSeconds(Integer additionalDurationInSeconds) {
+ this.additionalDurationInSeconds = additionalDurationInSeconds;
+ }
+
+ public Integer getConcurrencyLimit() {
+ return concurrencyLimit;
+ }
+
+ public void setConcurrencyLimit(Integer concurrencyLimit) {
+ this.concurrencyLimit = concurrencyLimit;
+ }
+
+ public List<ChangeWindow> getChangeWindows() {
+ return changeWindows;
+ }
+
+ public void setChangeWindows(List<ChangeWindow> changeWindows) {
+ this.changeWindows = changeWindows;
+ }
+
+ public List<PolicyInfo> getPolicies() {
+ return policies;
+ }
+
+ public void setPolicies(List<PolicyInfo> policies) {
+ this.policies = policies;
+ }
+
+ public List<ElementInfo> getElements() {
+ return elements;
+ }
+
+ public void setElements(List<ElementInfo> elements) {
+ this.elements = elements;
+ }
+
+}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java
index 7a7821e..41534f8 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java
@@ -34,6 +34,7 @@ package org.onap.optf.cmso.sostatus;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
+import java.util.UUID;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.client.Client;
@@ -87,10 +88,11 @@ public class MsoStatusClient {
@Autowired
PropertiesManagement pm;
- public void execute(Integer id) throws JobExecutionException {
+ public void execute(String id) throws JobExecutionException {
debug.debug(LogMessages.MSO_STATUS_JOB, "Entered", id.toString());
try {
- ChangeManagementSchedule cmSchedule = cmScheduleDAO.lockOne(id);
+ UUID uuid = UUID.fromString(id);
+ ChangeManagementSchedule cmSchedule = cmScheduleDAO.lockOne(uuid);
if (cmSchedule == null) {
Observation.report(LogMessages.MSO_POLLING_MISSING_SCHEDULE, id.toString());
return;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java
index df9f361..6c52cc3 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusJob.java
@@ -31,6 +31,8 @@
package org.onap.optf.cmso.sostatus;
+import java.util.UUID;
+
import org.onap.observations.Mdc;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.model.ChangeManagementSchedule;
@@ -73,20 +75,21 @@ public class MsoStatusJob implements Job {
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
Mdc.quartzJobBegin(context);
- Integer id = context.getJobDetail().getJobDataMap().getInt(ContextKeys.scheduleId.toString());
+ String id = context.getJobDetail().getJobDataMap().getString(ContextKeys.scheduleId.toString());
String requestId = context.getJobDetail().getJobDataMap().getString(ContextKeys.msoRequestId.toString());
debug.debug(LogMessages.MSO_STATUS_JOB, "Entered", requestId, id.toString());
try {
- ChangeManagementSchedule cmSchedule = cmScheduleDAO.findById(id).orElse(null);
+ UUID uuid = UUID.fromString(id);
+ ChangeManagementSchedule cmSchedule = cmScheduleDAO.findById(uuid).orElse(null);
if (cmSchedule == null) {
- log.warn(LogMessages.MSO_POLLING_MISSING_SCHEDULE, id.toString(), requestId);
+ log.warn(LogMessages.MSO_POLLING_MISSING_SCHEDULE, id, requestId);
return;
}
mso.poll(cmSchedule);
} catch (Exception e) {
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
}
- debug.debug(LogMessages.MSO_STATUS_JOB, "Exited", requestId, id.toString());
+ debug.debug(LogMessages.MSO_STATUS_JOB, "Exited", requestId, id);
}
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java
index c3254aa..1c3677c 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/ScheduleStatusJob.java
@@ -33,6 +33,7 @@ package org.onap.optf.cmso.sostatus;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
@@ -93,8 +94,8 @@ public class ScheduleStatusJob implements Job {
// First poll SO for WF status
List<ChangeManagementSchedule> list = cmScheduleDAO.findAllTriggered();
for (ChangeManagementSchedule s : list) {
- debug.debug("Dispathcing to check status of CM schedule Id=" + s.getId());
- dispatchMso(s.getId());
+ debug.debug("Dispathcing to check status of CM schedule Id=" + s.getUuid());
+ dispatchMso(s.getUuid());
}
} catch (Exception e) {
Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
@@ -106,7 +107,7 @@ public class ScheduleStatusJob implements Job {
List<Schedule> list = scheduleDAO.findAllInProgress(DomainsEnum.ChangeManagement.toString());
for (Schedule s : list) {
debug.debug("Dispatching to check status of scheduleId=" + s.getScheduleId());
- dispatchScheduleStatusChecker(s.getId());
+ dispatchScheduleStatusChecker(s.getUuid());
}
} catch (Exception e) {
Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
@@ -114,12 +115,12 @@ public class ScheduleStatusJob implements Job {
debug.debug(LogMessages.SCHEDULE_STATUS_JOB, "Exited");
}
- public void dispatchScheduleStatusChecker(Integer id) {
+ public void dispatchScheduleStatusChecker(UUID uuid) {
Map<String, String> mdcSave = Mdc.save();
try {
String url = env.getProperty("cmso.dispatch.url", "http://localhost:8089");
String path = env.getProperty("cmso.dispatch.status.path", "/cmso/dispatch/schedulestatus/");
- url = url + path + id;
+ url = url + path + uuid;
String user = env.getProperty("mechid.user", "");
String pass = pm.getProperty("mechid.pass", "");
Client client = ClientBuilder.newClient();
@@ -152,12 +153,12 @@ public class ScheduleStatusJob implements Job {
}
- public void dispatchMso(Integer id) {
+ public void dispatchMso(UUID uuid) {
Map<String, String> mdcSave = Mdc.save();
try {
String url = env.getProperty("cmso.dispatch.url", "http://localhost:8089");
String path = env.getProperty("cmso.dispatch.sostatus.path", "/cmso/dispatch/sostatus/");
- url = url + path + id;
+ url = url + path + uuid;
String user = env.getProperty("mechid.user", "");
String pass = pm.getProperty("mechid.pass", "");
Client client = ClientBuilder.newClient();
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java
index b240b61..b2ff6d4 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,7 +59,7 @@ import org.onap.optf.cmso.optimizer.bean.CMRequestInfo;
import org.onap.optf.cmso.optimizer.bean.CMSchedule;
import org.onap.optf.cmso.optimizer.bean.CMSchedulingInfo;
import org.onap.optf.cmso.optimizer.bean.CMVnfDetails;
-import org.onap.optf.cmso.service.rs.CMSCallbackImpl;
+import org.onap.optf.cmso.service.rs.CMSOOptimizerCallbackImpl;
import org.onap.optf.cmso.wf.bean.WfCmResponse200;
import org.onap.optf.cmso.wf.bean.WfMsoRequestReferences;
import org.onap.optf.cmso.wf.bean.WfMsoResponse;
@@ -101,11 +101,11 @@ public class SchedulerTestLoopbackServiceImpl implements SchedulerTestLoopbackSe
nodes.add(sr.getNode());
}
- DateTime startTime = CMSCallbackImpl.convertISODate(si.getStartTime(), "startTime");
+ DateTime startTime = CMSOOptimizerCallbackImpl.convertISODate(si.getStartTime(), "startTime");
// Ignore the finish time for now in the calc. Just accept what they
// gave
- DateTime finishTime = CMSCallbackImpl.convertISODate(si.getEndTime(), "endTime");
+ DateTime finishTime = CMSOOptimizerCallbackImpl.convertISODate(si.getEndTime(), "endTime");
DateTimeFormatter sniroFmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss").withZoneUTC();
int add = si.getAdditionalDurationInSecs();
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmStatusClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmStatusClient.java
index e5c14b1..e327acc 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmStatusClient.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmStatusClient.java
@@ -1,6 +1,6 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,6 +37,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.UUID;
+
import javax.transaction.Transactional;
import org.onap.optf.cmso.common.CMSStatusEnum;
import org.onap.optf.cmso.common.LogMessages;
@@ -97,11 +99,12 @@ public class TmStatusClient {
TmClient tmClient;
@Transactional
- public void checkStatus(Integer id) {
+ public void checkStatus(String id) {
debug.debug("Entered checkStatus id=" + id);
try {
// Multiple cmso instance support - re-get the record with a Schedule lock
- Schedule s = scheduleDAO.lockOne(id);
+ UUID uuid = UUID.fromString(id);
+ Schedule s = scheduleDAO.lockOne(uuid);
if (!s.getStatus().equals(CMSStatusEnum.NotificationsInitiated.toString())) {
debug.debug(s.getScheduleId() + " is no longer in " + CMSStatusEnum.NotificationsInitiated.toString()
+ " : it is " + s.getStatus());
@@ -110,7 +113,7 @@ public class TmStatusClient {
}
Map<GroupAuditStatus, List<ChangeManagementGroup>> groupStatus =
new HashMap<GroupAuditStatus, List<ChangeManagementGroup>>();
- List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(id);
+ List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(uuid);
// Close tickets for completed VNFs
for (ChangeManagementGroup group : groups) {
@@ -155,7 +158,7 @@ public class TmStatusClient {
Map<String, List<ChangeManagementSchedule>> inProgress = new HashMap<String, List<ChangeManagementSchedule>>();
Map<String, List<ChangeManagementSchedule>> completed = new HashMap<String, List<ChangeManagementSchedule>>();
Map<String, List<ChangeManagementSchedule>> tmClosed = new HashMap<String, List<ChangeManagementSchedule>>();
- List<ChangeManagementSchedule> cmSchedules = cmScheduleDAO.findByChangeManagementGroupId(group.getId());
+ List<ChangeManagementSchedule> cmSchedules = cmScheduleDAO.findByChangeManagementGroupId(group.getUuid());
for (ChangeManagementSchedule cmSchedule : cmSchedules) {
String status = cmSchedule.getStatus();
String changeId = cmSchedule.getTmChangeId();
@@ -230,7 +233,7 @@ public class TmStatusClient {
Set<String> failedNames = new HashSet<String>();
Set<String> completedNames = new HashSet<String>();
Long startDate = group.getStartTimeMillis();
- List<ChangeManagementSchedule> cmSchedules = cmScheduleDAO.findByChangeManagementGroupId(group.getId());
+ List<ChangeManagementSchedule> cmSchedules = cmScheduleDAO.findByChangeManagementGroupId(group.getUuid());
for (ChangeManagementSchedule cmSchedule : cmSchedules) {
String vnfName = cmSchedule.getVnfName();
vnfNames.add(vnfName);