aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmso-database/src/main/resources/optimizer-dbchanges/onap-optimizer-v1-schema.sql1
-rw-r--r--cmso-optimizer/data/policies/EveryDay_00_06.json47
-rw-r--r--cmso-optimizer/data/policies/Weekend_00_06.json38
-rw-r--r--cmso-optimizer/etc/config/optimizer.properties2
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManager.java7
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/AllowedPeriodicTime.java21
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/Policy.java20
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/TimeLimitAndVerticalTopology.java16
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/TimeRange.java6
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindows.java160
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/common/models/ElementCriteria.java63
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtClient.java231
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtRequestManager.java93
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/ActiveTicketsRequest.java114
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/ActiveTicketsResponse.java110
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/Availability.java35
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/TicketData.java129
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyClient.java96
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyRequestManager.java80
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/TopologyRequest.java1
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/LogMessages.java59
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/core/OptimizerManager.java93
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/model/Request.java11
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java64
-rw-r--r--cmso-optimizer/src/test/java/org/onap/optf/cmso/AuthProviderTest.java3
-rw-r--r--cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManagerTest.java13
-rw-r--r--cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindowsTest.java79
-rw-r--r--cmso-optimizer/src/test/java/org/onap/optf/cmso/service/rs/MockHttpServletRequest.java1
-rw-r--r--cmso-service/etc/config/optimizer.properties12
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/model/dao/ChangeManagementDetailDAOImpl.java22
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java12
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/OptimizerQuartzJob.java36
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/model/OptimizerRequest.java1
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizedScheduleServiceImpl.java1
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizerCallbackImpl.java2
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoServiceImpl.java38
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java3
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSInfo.java28
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSMessage.java24
-rw-r--r--cmso-topology/data/vnf1.json1
-rw-r--r--cmso-topology/src/main/java/org/onap/optf/cmso/common/CmsoRequestError.java3
-rw-r--r--cmso-topology/src/main/java/org/onap/optf/cmso/topology/filters/CmsoClientFilters.java4
42 files changed, 1522 insertions, 258 deletions
diff --git a/cmso-database/src/main/resources/optimizer-dbchanges/onap-optimizer-v1-schema.sql b/cmso-database/src/main/resources/optimizer-dbchanges/onap-optimizer-v1-schema.sql
index 02daa60..d91a17e 100644
--- a/cmso-database/src/main/resources/optimizer-dbchanges/onap-optimizer-v1-schema.sql
+++ b/cmso-database/src/main/resources/optimizer-dbchanges/onap-optimizer-v1-schema.sql
@@ -7,6 +7,7 @@ CREATE TABLE IF NOT EXISTS `optimizer`.`request` (
request_start BIGINT(20) NULL DEFAULT NULL,
request_end BIGINT(20) NULL DEFAULT NULL,
status VARCHAR(45) NULL DEFAULT NULL,
+ message MEDIUMTEXT NULL DEFAULT NULL,
PRIMARY KEY (`uuid`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
diff --git a/cmso-optimizer/data/policies/EveryDay_00_06.json b/cmso-optimizer/data/policies/EveryDay_00_06.json
new file mode 100644
index 0000000..53350ff
--- /dev/null
+++ b/cmso-optimizer/data/policies/EveryDay_00_06.json
@@ -0,0 +1,47 @@
+{
+ "service": "TimeLimitAndVerticalTopology",
+ "policyName": "CMSO.Weekday_00_06",
+ "description": "dev instance",
+ "templateVersion": "Dublin",
+ "version": "0001",
+ "priority": "4",
+ "riskType": "test",
+ "riskLevel": "3",
+ "guard": "False",
+ "content": {
+ "serviceType": "networkOnDemand",
+ "identity": "vnf_upgrade_policy",
+ "policyScope": {
+ "serviceType": ["networkOnDemand"],
+ "aicZone": [
+ " "
+ ],
+ "entityType": ["vnf"]
+ },
+ "timeSchedule": {
+ "allowedPeriodicTime": [
+ {
+ "day": "weekday",
+ "timeRange": [
+ {
+ "start_time": "00:00:00+00:00",
+ "end_time": "06:00:00+00:00"
+ }
+ ]
+ },
+ {
+ "day": "weekend",
+ "timeRange": [
+ {
+ "start_time": "00:00:00+00:00",
+ "end_time": "06:00:00+00:00"
+ }
+ ]
+ }
+ ]
+ },
+ "nodeType": ["vnf"],
+ "type": "timeLimitAndVerticalTopology",
+ "conflictScope": "vnf_pserver"
+ }
+} \ No newline at end of file
diff --git a/cmso-optimizer/data/policies/Weekend_00_06.json b/cmso-optimizer/data/policies/Weekend_00_06.json
new file mode 100644
index 0000000..5e26cb4
--- /dev/null
+++ b/cmso-optimizer/data/policies/Weekend_00_06.json
@@ -0,0 +1,38 @@
+{
+ "service": "TimeLimitAndVerticalTopology",
+ "policyName": "CMSO.Weekday_00_06",
+ "description": "dev instance",
+ "templateVersion": "Dublin",
+ "version": "0001",
+ "priority": "4",
+ "riskType": "test",
+ "riskLevel": "3",
+ "guard": "False",
+ "content": {
+ "serviceType": "networkOnDemand",
+ "identity": "vnf_upgrade_policy",
+ "policyScope": {
+ "serviceType": ["networkOnDemand"],
+ "aicZone": [
+ " "
+ ],
+ "entityType": ["vnf"]
+ },
+ "timeSchedule": {
+ "allowedPeriodicTime": [
+ {
+ "day": "weekend",
+ "timeRange": [
+ {
+ "start_time": "00:00:00+00:00",
+ "end_time": "06:00:00+00:00"
+ }
+ ]
+ }
+ ]
+ },
+ "nodeType": ["vnf"],
+ "type": "timeLimitAndVerticalTopology",
+ "conflictScope": "vnf_pserver"
+ }
+} \ No newline at end of file
diff --git a/cmso-optimizer/etc/config/optimizer.properties b/cmso-optimizer/etc/config/optimizer.properties
index 8b8c6a1..ac39ec8 100644
--- a/cmso-optimizer/etc/config/optimizer.properties
+++ b/cmso-optimizer/etc/config/optimizer.properties
@@ -45,5 +45,5 @@ logging.level.org.hibernate=TRACE
cmso.topology.create.request.url=http://127.0.0.1:7998/topology/v1/current
-
+cmso.ticket.create.request.url=http://127.0.0.1:7999/ticketmgt/v1/activetickets
cmso.local.policy.folder=data/policies \ No newline at end of file
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManager.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManager.java
index d6ae196..d82932b 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManager.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManager.java
@@ -44,12 +44,9 @@ public class PolicyManager {
TimeLimitAndVerticalTopology returnPolicy = null;
if (policy != null) {
ObjectMapper om = new ObjectMapper();
- try
- {
+ try {
returnPolicy = om.convertValue(policy.getContent(), TimeLimitAndVerticalTopology.class);
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
}
}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/AllowedPeriodicTime.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/AllowedPeriodicTime.java
index 4bc0f71..abdb5f8 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/AllowedPeriodicTime.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/AllowedPeriodicTime.java
@@ -36,28 +36,35 @@ import java.util.List;
*/
public class AllowedPeriodicTime {
- public enum Day
- {
- weekday("RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR"),
- weekend("RRULE:FREQ=WEEKLY;BYDAY=SA,SU"),
- ;
+ public enum Day {
+ weekday("RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR"), weekend("RRULE:FREQ=WEEKLY;BYDAY=SA,SU"),;
private String rrule;
- private Day(String rrule) {this.rrule = rrule;}
- public String getRrule() {return rrule;}
+
+ private Day(String rrule) {
+ this.rrule = rrule;
+ }
+
+ public String getRrule() {
+ return rrule;
+ }
}
private Day day;
private List<TimeRange> timeRange;
+
public Day getDay() {
return day;
}
+
public void setDay(Day day) {
this.day = day;
}
+
public List<TimeRange> getTimeRange() {
return timeRange;
}
+
public void setTimeRange(List<TimeRange> timeRange) {
this.timeRange = timeRange;
}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/Policy.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/Policy.java
index 50acd9b..f6bdf74 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/Policy.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/Policy.java
@@ -71,63 +71,83 @@ public class Policy {
private String riskLevel;
private String guard;
private Object content;
+
public String getService() {
return service;
}
+
public void setService(String service) {
this.service = service;
}
+
public String getPolicyName() {
return policyName;
}
+
public void setPolicyName(String policyName) {
this.policyName = policyName;
}
+
public String getDescription() {
return description;
}
+
public void setDescription(String description) {
this.description = description;
}
+
public String getTemplateVersion() {
return templateVersion;
}
+
public void setTemplateVersion(String templateVersion) {
this.templateVersion = templateVersion;
}
+
public String getVersion() {
return version;
}
+
public void setVersion(String version) {
this.version = version;
}
+
public String getPriority() {
return priority;
}
+
public void setPriority(String priority) {
this.priority = priority;
}
+
public String getRiskType() {
return riskType;
}
+
public void setRiskType(String riskType) {
this.riskType = riskType;
}
+
public String getRiskLevel() {
return riskLevel;
}
+
public void setRiskLevel(String riskLevel) {
this.riskLevel = riskLevel;
}
+
public String getGuard() {
return guard;
}
+
public void setGuard(String guard) {
this.guard = guard;
}
+
public Object getContent() {
return content;
}
+
public void setContent(Object content) {
this.content = content;
}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/TimeLimitAndVerticalTopology.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/TimeLimitAndVerticalTopology.java
index 58846f4..7af22e3 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/TimeLimitAndVerticalTopology.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/TimeLimitAndVerticalTopology.java
@@ -51,8 +51,7 @@ import java.util.List;
}
*/
-public class TimeLimitAndVerticalTopology
-{
+public class TimeLimitAndVerticalTopology {
public enum ConflictScope {
timeLimitAndVerticalTopology,
@@ -72,42 +71,55 @@ public class TimeLimitAndVerticalTopology
public String getServiceType() {
return serviceType;
}
+
public void setServiceType(String serviceType) {
this.serviceType = serviceType;
}
+
public String getIdentity() {
return identity;
}
+
public void setIdentity(String identity) {
this.identity = identity;
}
+
public PolicyScope getPolicyScope() {
return policyScope;
}
+
public void setPolicyScope(PolicyScope policyScope) {
this.policyScope = policyScope;
}
+
public TimeSchedule getTimeSchedule() {
return timeSchedule;
}
+
public void setTimeSchedule(TimeSchedule timeSchedule) {
this.timeSchedule = timeSchedule;
}
+
public List<String> getNodeType() {
return nodeType;
}
+
public void setNodeType(List<String> nodeType) {
this.nodeType = nodeType;
}
+
public String getType() {
return type;
}
+
public void setType(String type) {
this.type = type;
}
+
public String getConflictScope() {
return conflictScope;
}
+
public void setConflictScope(String conflictScope) {
this.conflictScope = conflictScope;
}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/TimeRange.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/TimeRange.java
index 6b6ba0b..0f8f851 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/TimeRange.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/policies/model/TimeRange.java
@@ -27,20 +27,22 @@ package org.onap.optf.cmso.optimizer.availability.policies.model;
}
*/
-public class TimeRange
-{
+public class TimeRange {
private String start_time;
private String end_time;
public String getStart_time() {
return start_time;
}
+
public void setStart_time(String start_time) {
this.start_time = start_time;
}
+
public String getEnd_time() {
return end_time;
}
+
public void setEnd_time(String end_time) {
this.end_time = end_time;
}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindows.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindows.java
index f9704ff..dce64b4 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindows.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindows.java
@@ -19,10 +19,25 @@
package org.onap.optf.cmso.optimizer.availability.timewindows;
+import com.google.ical.compat.jodatime.DateTimeIterator;
+import com.google.ical.compat.jodatime.DateTimeIteratorFactory;
+import java.text.ParseException;
import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.OffsetDateTime;
+import java.time.OffsetTime;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
import org.onap.observations.Observation;
import org.onap.optf.cmso.optimizer.availability.policies.model.AllowedPeriodicTime;
import org.onap.optf.cmso.optimizer.availability.policies.model.TimeLimitAndVerticalTopology;
@@ -30,8 +45,18 @@ import org.onap.optf.cmso.optimizer.availability.policies.model.TimeRange;
import org.onap.optf.cmso.optimizer.common.LogMessages;
import org.onap.optf.cmso.optimizer.service.rs.models.ChangeWindow;
+/**
+ * The Class RecurringWindows.
+ */
public class RecurringWindows {
+ /**
+ * Gets the availability windows for policies.
+ *
+ * @param policies the policies
+ * @param changeWindow the change window
+ * @return the availability windows for policies
+ */
public static List<ChangeWindow> getAvailabilityWindowsForPolicies(List<TimeLimitAndVerticalTopology> policies,
ChangeWindow changeWindow) {
List<ChangeWindow> availableList = new ArrayList<>();
@@ -42,19 +67,46 @@ public class RecurringWindows {
}
}
}
+ // Collapse all duplicate and overlapping availabity windows into minimum
+ // number of windows
+ availableList = collapseWindows(availableList);
return availableList;
}
+ private static List<ChangeWindow> collapseWindows(List<ChangeWindow> availableList) {
+ List<ChangeWindow> collapsed = new ArrayList<>();
+ Set<ChangeWindow> consumed = new HashSet<>();
+ for (ChangeWindow win : availableList) {
+ if (!consumed.contains(win)) {
+ // Find all windows that can collapse into this one
+ consumed.add(win);
+ boolean allUnique = false;
+ while (!allUnique) {
+ allUnique = true;
+ for (ChangeWindow test : availableList) {
+ // if availability windows overlap
+ if (!consumed.contains(test)) {
+ if (win.absorbIfOverlapping(test)) {
+ consumed.add(test);
+ allUnique = false;
+ }
+ }
+ }
+ }
+ collapsed.add(win);
+ }
+ }
+ return collapsed;
+ }
+
// "RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR",
private static void getAvailableWindowsForApt(AllowedPeriodicTime available, ChangeWindow changeWindow,
List<ChangeWindow> availableList) {
- if (available.getDay() != null)
- {
- switch (available.getDay())
- {
+ if (available.getDay() != null) {
+ switch (available.getDay()) {
case weekday:
case weekend:
getAvailableWindowsForAptDay(available, changeWindow, availableList);
@@ -63,46 +115,102 @@ public class RecurringWindows {
}
}
+ availableList.add(changeWindow);
Observation.report(LogMessages.UNSUPPORTED_PERIODIC_TIME, available.toString());
}
+
// "RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR",
+
private static void getAvailableWindowsForAptDay(AllowedPeriodicTime available, ChangeWindow changeWindow,
List<ChangeWindow> availableList) {
- try
- {
+ try {
List<TimeRange> ranges = available.getTimeRange();
- if (ranges.size() == 0)
- {
+ if (ranges.size() == 0) {
TimeRange range = new TimeRange();
range.setStart_time("00:00:00+00:00");
range.setStart_time("23:59:59+00:00");
ranges.add(range);
}
- String rrule = available.getDay().getRrule();
- for (TimeRange range : ranges)
- {
-
- Date cwStartDate =changeWindow.getStartTime();
- Date cwEndDate =changeWindow.getEndTime();
-
- Instant cwStartInstant = Instant.ofEpochMilli(cwStartDate.getTime());
- Instant cwEndInstant = Instant.ofEpochMilli(cwEndDate.getTime());
- Instant startInstant = Instant.parse(range.getStart_time());
- Instant endInstant = Instant.parse(range.getEnd_time());
- if (cwStartInstant.isAfter(startInstant))
- {
- // We expect this since startInstant has no date (1/1/1970)
- //
+ StringBuilder rdata = new StringBuilder();
+ rdata.append(available.getDay().getRrule()).append("\n");
+ for (TimeRange range : ranges) {
+ processRange(range, changeWindow, availableList, rdata);
+ }
+ } catch (Exception e) {
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ }
+ }
+
+
+ private static void processRange(TimeRange range, ChangeWindow changeWindow, List<ChangeWindow> availableList,
+ StringBuilder rdata) throws ParseException {
+
+ Instant cwStartInstant = changeWindow.getStartTime().toInstant();
+ Instant cwEndInstant = changeWindow.getEndTime().toInstant();
+
+ List<DateTime> startList = getRecurringList(range.getStart_time(), cwStartInstant, rdata, cwEndInstant);
+ List<DateTime> endList = getRecurringList(range.getEnd_time(), cwStartInstant, rdata, cwEndInstant);
+ // Pair them up to make change windows
+ // Everything should be UTC time
+ for (int i = 0; i < startList.size(); i++) {
+ DateTime startDt = startList.get(i);
+ if (i < endList.size()) {
+ DateTime endDt = endList.get(i);
+ if (endDt.isAfter(startDt)) {
+ ChangeWindow cw = new ChangeWindow();
+ cw.setStartTime(startDt.toDate());
+ cw.setEndTime(endDt.toDate());
+ availableList.add(cw);
}
+ }
+ }
+
+ }
+
+ private static List<DateTime> getRecurringList(String rangeTime, Instant cwStartInstant, StringBuilder rdata,
+ Instant cwEndInstant) throws ParseException {
+
+ Instant startInstant = getInstanceFromTime(rangeTime, cwStartInstant);
+ DateTime start = new DateTime(startInstant.toEpochMilli());
+ DateTimeIterator recur =
+ DateTimeIteratorFactory.createDateTimeIterator(rdata.toString(), start, DateTimeZone.UTC, true);
+ List<DateTime> list = new ArrayList<>();
+ while (recur.hasNext()) {
+ DateTime next = recur.next();
+ // System.out.println(next.toString());
+ if (next.isAfter(cwEndInstant.toEpochMilli())) {
+ break;
}
+ list.add(next);
}
- catch (Exception e)
- {
- Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ return list;
+ }
+
+
+ //
+ // The policies with 'Day' enumeration only have time with no day so we add the
+ // date portion of the change window to the dtstart
+ //
+ private static Instant getInstanceFromTime(String timeIn, Instant cwStartInstant) {
+ Instant instant = null;
+ Instant date = cwStartInstant.truncatedTo(ChronoUnit.DAYS);
+ LocalDate epoch = LocalDate.ofEpochDay(0);
+ try {
+ OffsetTime offset = OffsetTime.parse(timeIn);
+ OffsetDateTime odt = offset.atDate(epoch);
+ ZonedDateTime startTime = odt.atZoneSameInstant(ZoneOffset.UTC.normalized());
+ instant = Instant.from(startTime);
+ } catch (Exception e) {
+ LocalTime local = LocalTime.parse(timeIn);
+ LocalDateTime ldt = local.atDate(epoch);
+ ZonedDateTime startTime = ldt.atZone(ZoneOffset.UTC.normalized());
+ instant = Instant.from(startTime);
}
+ return instant.plus(date.toEpochMilli(), ChronoUnit.MILLIS);
}
+
}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/common/models/ElementCriteria.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/common/models/ElementCriteria.java
new file mode 100644
index 0000000..7b16a2f
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/common/models/ElementCriteria.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ *
+ * 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.optimizer.clients.common.models;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import org.onap.optf.cmso.optimizer.service.rs.models.NameValue;
+
+@ApiModel(value = "Element Critera", description = "Element criteria for retrieving topology.")
+public class ElementCriteria implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "Element id unique to the request.")
+ private String elementId;
+
+ @ApiModelProperty(value = "Implementation specific element data.")
+ public List<NameValue> elementData = new ArrayList<>();
+
+ 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;
+ }
+
+}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtClient.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtClient.java
new file mode 100644
index 0000000..21f0d76
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtClient.java
@@ -0,0 +1,231 @@
+/*
+ * ============LICENSE_START==============================================
+ * Copyright (c) 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.
+ * ============LICENSE_END=================================================
+ *
+ */
+
+package org.onap.optf.cmso.optimizer.clients.ticketmgt;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+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.Entity;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import org.onap.observations.Observation;
+import org.onap.optf.cmso.common.BasicAuthenticatorFilter;
+import org.onap.optf.cmso.common.PropertiesManagement;
+import org.onap.optf.cmso.common.exceptions.CmsoException;
+import org.onap.optf.cmso.optimizer.clients.common.models.ElementCriteria;
+import org.onap.optf.cmso.optimizer.clients.ticketmgt.models.ActiveTicketsRequest;
+import org.onap.optf.cmso.optimizer.clients.ticketmgt.models.ActiveTicketsResponse;
+import org.onap.optf.cmso.optimizer.clients.ticketmgt.models.ActiveTicketsResponse.ActiveTicketResponseStatus;
+import org.onap.optf.cmso.optimizer.clients.topology.TopologyRequestManager;
+import org.onap.optf.cmso.optimizer.clients.topology.models.ConstraintElements;
+import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyElementInfo;
+import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyPolicyInfo;
+import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyResponse;
+import org.onap.optf.cmso.optimizer.common.LogMessages;
+import org.onap.optf.cmso.optimizer.filters.CmsoClientFilters;
+import org.onap.optf.cmso.optimizer.model.Request;
+import org.onap.optf.cmso.optimizer.model.Ticket;
+import org.onap.optf.cmso.optimizer.model.Topology;
+import org.onap.optf.cmso.optimizer.model.dao.RequestDao;
+import org.onap.optf.cmso.optimizer.model.dao.TicketDao;
+import org.onap.optf.cmso.optimizer.service.rs.models.ElementInfo;
+import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerRequest;
+import org.onap.optf.cmso.optimizer.service.rs.models.PolicyInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+/**
+ * The Class TicketMgtClient.
+ */
+@Component
+public class TicketMgtClient {
+ private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
+
+ @Autowired
+ Environment env;
+
+ @Autowired
+ PropertiesManagement pm;
+
+ @Autowired
+ RequestDao requestDao;
+
+ @Autowired
+ TicketDao ticketDao;
+
+ @Autowired
+ TopologyRequestManager topologyRequestManager;
+
+ /**
+ * Make request of ticket mgt system.
+ *
+ * @param requestRow the request row
+ * @param ticketRow the ticket row
+ * @return the active tickets response
+ */
+ public ActiveTicketsResponse makeRequest(Request requestRow, Ticket ticketRow) {
+ ActiveTicketsResponse ticketResponse = new ActiveTicketsResponse();
+ Integer maxAttempts = env.getProperty("cmso.optimizer.maxAttempts", Integer.class, 20);
+ if (ticketRow.getTicketsRetries() >= maxAttempts) {
+ ticketResponse.setStatus(ActiveTicketResponseStatus.FAILED);
+ ticketResponse.setErrorMessage(LogMessages.EXCEEDED_RETRY_LIMIT.format("Topology", maxAttempts.toString()));
+ Observation.report(LogMessages.EXCEEDED_RETRY_LIMIT, "TicketMgt", maxAttempts.toString());
+ return ticketResponse;
+ }
+ ObjectMapper om = new ObjectMapper();
+ String originalRequest = requestRow.getRequest();
+ OptimizerRequest optimizerRequest = null;;
+ try {
+ optimizerRequest = om.readValue(originalRequest, OptimizerRequest.class);
+ ActiveTicketsRequest apiRequest = buildRequest(optimizerRequest);
+ ticketResponse = initiateApiRequest(apiRequest, ticketRow, requestRow);
+ } catch (Exception e) {
+ ticketResponse.setStatus(ActiveTicketResponseStatus.FAILED);
+ ticketResponse.setErrorMessage(LogMessages.UNEXPECTED_EXCEPTION.format(e.getMessage()));
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ }
+ return ticketResponse;
+ }
+
+ private ActiveTicketsRequest buildRequest(OptimizerRequest optimizerRequest)
+ throws JsonParseException, JsonMappingException, IOException {
+ UUID uuid = UUID.fromString(optimizerRequest.getRequestId());
+ Topology topologyRow = topologyRequestManager.getExistingTopology(uuid);
+ String topologyString = topologyRow.getTopology();
+ TopologyResponse topologyResponse = new ObjectMapper().readValue(topologyString, TopologyResponse.class);
+ ActiveTicketsRequest apiRequest = new ActiveTicketsRequest();
+ apiRequest.setRequestId(optimizerRequest.getRequestId());
+ apiRequest.setCommonData(optimizerRequest.getCommonData());
+ apiRequest.setChangeWindows(optimizerRequest.getChangeWindows());
+ apiRequest.setElements(getElementCriteria(topologyResponse));
+ return apiRequest;
+ }
+
+ private List<TopologyPolicyInfo> getPolicies(OptimizerRequest optimizerRequest) {
+ List<TopologyPolicyInfo> list = new ArrayList<>();
+ for (PolicyInfo optInfo : optimizerRequest.getPolicies()) {
+ TopologyPolicyInfo topInfo = new TopologyPolicyInfo();
+ topInfo.setPolicyDescription(optInfo.getPolicyDescription());
+ topInfo.setPolicyName(optInfo.getPolicyName());
+ topInfo.setPolicyModifiers(optInfo.getPolicyModifiers());
+ list.add(topInfo);
+ }
+ return list;
+ }
+
+ private List<ElementCriteria> getElementCriteria(TopologyResponse topologyResponse) {
+ Map<String, ElementCriteria> map = new HashMap<>();
+ for (TopologyElementInfo info : topologyResponse.getElements()) {
+ ElementCriteria criteria = new ElementCriteria();
+ criteria.setElementId(info.getElementId());
+ criteria.setElementData(info.getElementData());
+ map.put(criteria.getElementId(), criteria);
+ if (info.getRequiredElements() != null) {
+ for (String required : info.getRequiredElements()) {
+ if (!map.containsKey(required)) {
+ ElementCriteria crit = new ElementCriteria();
+ crit.setElementId(required);
+ map.put(crit.getElementId(), crit);
+ }
+ }
+ }
+ if (info.getConstraintElements() != null) {
+ for (ConstraintElements constraint : info.getConstraintElements()) {
+ if (!map.containsKey(constraint.getElementId())) {
+ ElementCriteria crit = new ElementCriteria();
+ crit.setElementId(constraint.getElementId());
+ map.put(crit.getElementId(), crit);
+ }
+ }
+ }
+
+ }
+ List<ElementCriteria> list = new ArrayList<>();
+ list.addAll(map.values());
+ return list;
+ }
+
+
+ private ActiveTicketsResponse initiateApiRequest(ActiveTicketsRequest apiRequest, Ticket ticketRow,
+ Request requestRow) throws CmsoException, JsonProcessingException {
+ String url = env.getProperty("cmso.ticket.create.request.url");
+ String username = env.getProperty("mechid.user");
+ String password = pm.getProperty("mechid.pass", "");
+ Client client = ClientBuilder.newClient();
+ client.register(new BasicAuthenticatorFilter(username, password));
+ client.register(new CmsoClientFilters());
+ debug.debug("topology url / user: " + url + " / " + username);
+ debug.debug("topology Request: " + new ObjectMapper().writeValueAsString(apiRequest));
+ Observation.report(LogMessages.TOPOLOGY_REQUEST, "Begin", apiRequest.getRequestId(), url);
+ ticketRow.setTicketsStart(System.currentTimeMillis());
+
+ WebTarget webTarget = client.target(url);
+ Invocation.Builder invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
+ Response response = invocationBuilder.post(Entity.json(apiRequest));
+ Observation.report(LogMessages.TOPOLOGY_REQUEST, "End", apiRequest.getRequestId(), url);
+ ActiveTicketsResponse apiResponse = null;
+ switch (response.getStatus()) {
+ case 202:
+ debug.debug("Successfully scheduled asynchronous ticket request: " + apiRequest.getRequestId());
+ break;
+ case 200:
+ debug.debug("Successfully retrieved tickets: " + apiRequest.getRequestId());
+ apiResponse = processApiResponse(apiRequest, response, ticketRow, requestRow);
+ break;
+ default:
+ throw new CmsoException(Status.INTERNAL_SERVER_ERROR, LogMessages.UNEXPECTED_RESPONSE, url,
+ response.getStatusInfo().toString());
+ }
+ return apiResponse;
+ }
+
+ private ActiveTicketsResponse processApiResponse(ActiveTicketsRequest apiRequest, Response response,
+ Ticket ticketRow, Request requestRow) {
+ String responseString = response.readEntity(String.class);
+ ActiveTicketsResponse apiResponse = null;
+ try {
+ apiResponse = new ObjectMapper().readValue(responseString, ActiveTicketsResponse.class);
+ ticketRow.setTickets(responseString);
+ } catch (Exception e) {
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ apiResponse = new ActiveTicketsResponse();
+ apiResponse.setRequestId(apiRequest.getRequestId());
+ apiResponse.setStatus(ActiveTicketResponseStatus.FAILED);
+ apiResponse.setErrorMessage(e.getMessage());
+ }
+ return apiResponse;
+ }
+
+}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtRequestManager.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtRequestManager.java
new file mode 100644
index 0000000..8c7dfb6
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/TicketMgtRequestManager.java
@@ -0,0 +1,93 @@
+/*
+ * ============LICENSE_START==============================================
+ * Copyright (c) 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.
+ * ============LICENSE_END=================================================
+ *
+ */
+
+package org.onap.optf.cmso.optimizer.clients.ticketmgt;
+
+import java.util.Optional;
+import org.onap.observations.Observation;
+import org.onap.optf.cmso.optimizer.clients.ticketmgt.models.ActiveTicketsResponse;
+import org.onap.optf.cmso.optimizer.common.LogMessages;
+import org.onap.optf.cmso.optimizer.model.Request;
+import org.onap.optf.cmso.optimizer.model.Ticket;
+import org.onap.optf.cmso.optimizer.model.dao.RequestDao;
+import org.onap.optf.cmso.optimizer.model.dao.TicketDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+/**
+ * Ticket Mgt request manager.
+ *
+ * @author jf9860
+ *
+ */
+@Component
+public class TicketMgtRequestManager {
+
+ @Autowired
+ Environment env;
+
+ @Autowired
+ RequestDao requestDao;
+
+ @Autowired
+ TicketDao ticketDao;
+
+ @Autowired
+ TicketMgtClient ticketmgtClient;
+
+ /**
+ * Creates the topology request.
+ *
+ * @param requestRow the uuid
+ * @return the active tickets response
+ */
+ public ActiveTicketsResponse createTicketsRequest(Request requestRow) {
+ try {
+ Ticket row = null;
+ Optional<Ticket> rowOpt = ticketDao.findById(requestRow.getUuid());
+ if (rowOpt.isPresent()) {
+ row = rowOpt.get();
+
+ }
+ if (row == null) {
+ row = new Ticket();
+ row.setUuid(requestRow.getUuid());
+ row.setTicketsRetries(0);
+ }
+ ActiveTicketsResponse apiResponse = ticketmgtClient.makeRequest(requestRow, row);
+ switch (apiResponse.getStatus()) {
+ case COMPLETED:
+ break;
+ case FAILED:
+ break;
+ case IN_PROGRESS:
+ break;
+ default:
+ break;
+ }
+ return apiResponse;
+ } catch (Exception e) {
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ }
+ return null;
+
+ }
+
+}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/ActiveTicketsRequest.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/ActiveTicketsRequest.java
new file mode 100644
index 0000000..f03c6f3
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/ActiveTicketsRequest.java
@@ -0,0 +1,114 @@
+/*
+ * 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.optimizer.clients.ticketmgt.models;
+
+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.ApiModelProperty;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import org.onap.optf.cmso.optimizer.clients.common.models.ElementCriteria;
+import org.onap.optf.cmso.optimizer.service.rs.models.ChangeWindow;
+import org.onap.optf.cmso.optimizer.service.rs.models.NameValue;
+
+public class ActiveTicketsRequest implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(ActiveTicketsRequest.class);
+
+ @ApiModelProperty(value = "Unique Id of the request")
+ private String requestId;
+
+ @ApiModelProperty(
+ value = "Implementation specific name value pairs provided to be passed to Ticket Management query .")
+ private List<NameValue> commonData;
+
+ @ApiModelProperty(value = "Lists of desired change windows for which TicketData will be returned.")
+ private List<ChangeWindow> changeWindows = new ArrayList<>();
+
+ @ApiModelProperty(value = "List of the elements for which TicketData will be returned.")
+ private List<ElementCriteria> elements = new ArrayList<>();
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+
+ public List<NameValue> getCommonData() {
+ return commonData;
+ }
+
+
+ public void setCommonData(List<NameValue> commonData) {
+ this.commonData = commonData;
+ }
+
+
+ public List<ChangeWindow> getChangeWindows() {
+ return changeWindows;
+ }
+
+
+ public void setChangeWindows(List<ChangeWindow> changeWindows) {
+ this.changeWindows = changeWindows;
+ }
+
+
+ public List<ElementCriteria> getElements() {
+ return elements;
+ }
+
+
+ public void setElements(List<ElementCriteria> elements) {
+ this.elements = elements;
+ }
+
+
+ @Override
+ 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-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/ActiveTicketsResponse.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/ActiveTicketsResponse.java
new file mode 100644
index 0000000..9780af6
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/ActiveTicketsResponse.java
@@ -0,0 +1,110 @@
+/*
+ * 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.optimizer.clients.ticketmgt.models;
+
+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 java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ActiveTicketsResponse implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(ActiveTicketsResponse.class);
+
+ public enum ActiveTicketResponseStatus {
+ IN_PROGRESS, COMPLETED, FAILED,
+ }
+
+ private String requestId;
+
+ private List<TicketData> elements = new ArrayList<>();
+
+ private ActiveTicketResponseStatus status;
+
+ private Integer pollingSeconds;
+ private String errorMessage;
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public List<TicketData> getElements() {
+ return elements;
+ }
+
+ public void setElements(List<TicketData> elements) {
+ this.elements = elements;
+ }
+
+ public ActiveTicketResponseStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(ActiveTicketResponseStatus status) {
+ this.status = status;
+ }
+
+ public Integer getPollingSeconds() {
+ return pollingSeconds;
+ }
+
+ public void setPollingSeconds(Integer pollingSeconds) {
+ this.pollingSeconds = pollingSeconds;
+ }
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ @Override
+ 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-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/Availability.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/Availability.java
new file mode 100644
index 0000000..37995bb
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/Availability.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ *
+ * 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.optimizer.clients.ticketmgt.models;
+
+public enum Availability {
+ full, partial, unavailable
+}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/TicketData.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/TicketData.java
new file mode 100644
index 0000000..07b9f94
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/ticketmgt/models/TicketData.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ *
+ * 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.optimizer.clients.ticketmgt.models;
+
+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;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import org.springframework.format.annotation.DateTimeFormat;
+
+@ApiModel(value = "Ticket Data", description = "Change Management Ticket Information.")
+public class TicketData implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(TicketData.class);
+
+ @ApiModelProperty(value = "Unique ticket identifier")
+ private String id;
+
+ @ApiModelProperty(value = "Scheduled start time of change.")
+ @DateTimeFormat(pattern = "yyyy-MM-dd'T'hh:mm:ss'Z'")
+ private Date startTime;
+
+ @ApiModelProperty(value = "Scheduled end time of change.")
+ @DateTimeFormat(pattern = "yyyy-MM-dd'T'hh:mm:ss'Z'")
+ private Date endTime;
+
+ @ApiModelProperty(value = "Availability of element(s) during change window")
+ private Availability availability;
+
+ @ApiModelProperty(
+ value = "List elementIds of elements being changed. At least one maps to elementId in the request")
+ private List<String> elementIds = new ArrayList<>();
+
+ @ApiModelProperty(value = "Details of the change.")
+ private String changeDetails;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ 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 Availability getAvailability() {
+ return availability;
+ }
+
+ public void setAvailability(Availability availability) {
+ this.availability = availability;
+ }
+
+ public List<String> getElementIds() {
+ return elementIds;
+ }
+
+ public void setElementIds(List<String> elementIds) {
+ this.elementIds = elementIds;
+ }
+
+ public String getChangeDetails() {
+ return changeDetails;
+ }
+
+ public void setChangeDetails(String changeDetails) {
+ this.changeDetails = changeDetails;
+ }
+
+ @Override
+ 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-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyClient.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyClient.java
index 7674f43..c333651 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyClient.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyClient.java
@@ -21,11 +21,9 @@ package org.onap.optf.cmso.optimizer.clients.topology;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.core.JsonParseException;
+import com.att.eelf.i18n.EELFResourceManager;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.client.Client;
@@ -40,7 +38,7 @@ import org.onap.observations.Observation;
import org.onap.optf.cmso.common.BasicAuthenticatorFilter;
import org.onap.optf.cmso.common.PropertiesManagement;
import org.onap.optf.cmso.common.exceptions.CmsoException;
-import org.onap.optf.cmso.optimizer.clients.topology.models.ElementCriteria;
+import org.onap.optf.cmso.optimizer.clients.common.models.ElementCriteria;
import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyPolicyInfo;
import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyRequest;
import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyResponse;
@@ -53,12 +51,14 @@ import org.onap.optf.cmso.optimizer.model.dao.RequestDao;
import org.onap.optf.cmso.optimizer.model.dao.TopologyDao;
import org.onap.optf.cmso.optimizer.service.rs.models.ElementInfo;
import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerRequest;
-import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerResponse.OptimizeScheduleStatus;
import org.onap.optf.cmso.optimizer.service.rs.models.PolicyInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+/**
+ * The Class TopologyClient.
+ */
@Component
public class TopologyClient {
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@@ -75,37 +75,47 @@ public class TopologyClient {
@Autowired
TopologyDao topologyDao;
+ /**
+ * Make request.
+ *
+ * @param request the request
+ * @param topology the topology
+ * @return the topology response
+ */
public TopologyResponse makeRequest(Request request, Topology topology) {
- Integer maxAttempts = env.getProperty("cmso.optimizer.maxAttempts", Integer.class, 20);
- if (topology.getTopologyRetries() >= maxAttempts) {
- request.setStatus(OptimizeScheduleStatus.FAILED.toString());
- request.setRequestEnd(System.currentTimeMillis());
- requestDao.save(request);
- return null;
- }
- TopologyRequest topologyRequest = new TopologyRequest();
- ObjectMapper om = new ObjectMapper();
- String originalRequest = request.getRequest();
- TopologyResponse topologyResponse = new TopologyResponse();
- OptimizerRequest optimizerRequest = null;;
- try {
- optimizerRequest = om.readValue(originalRequest, OptimizerRequest.class);
- } catch (Exception e) {
- topologyResponse.setStatus(TopologyRequestStatus.FAILED);
- Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- }
- topologyRequest = new TopologyRequest();
- topologyRequest.setRequestId(optimizerRequest.getRequestId());
- topologyRequest.setCommonData(optimizerRequest.getCommonData());
- topologyRequest.setElements(getElementCriteria(optimizerRequest));
- topologyRequest.setPolicies(getPolicies(optimizerRequest));
- try {
- topologyResponse = initiateTopology(topologyRequest, topology, request);
- } catch (Exception e) {
- topologyResponse.setStatus(TopologyRequestStatus.FAILED);
- Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- }
+ Integer maxAttempts = env.getProperty("cmso.optimizer.maxAttempts", Integer.class, 20);
+ TopologyResponse topologyResponse = new TopologyResponse();
+ if (topology.getTopologyRetries() >= maxAttempts) {
+ topologyResponse.setStatus(TopologyRequestStatus.FAILED);
+ topologyResponse.setErrorMessage(LogMessages.EXCEEDED_RETRY_LIMIT.format(
+ "Topology", maxAttempts.toString()));
+ Observation.report(LogMessages.EXCEEDED_RETRY_LIMIT, "Topology", maxAttempts.toString());
return topologyResponse;
+ }
+ TopologyRequest topologyRequest = new TopologyRequest();
+ ObjectMapper om = new ObjectMapper();
+ String originalRequest = request.getRequest();
+ OptimizerRequest optimizerRequest = null;;
+ try {
+ optimizerRequest = om.readValue(originalRequest, OptimizerRequest.class);
+ } catch (Exception e) {
+ topologyResponse.setStatus(TopologyRequestStatus.FAILED);
+ topologyResponse.setErrorMessage(LogMessages.UNEXPECTED_EXCEPTION.format(e.getMessage()));
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ }
+ topologyRequest = new TopologyRequest();
+ topologyRequest.setRequestId(optimizerRequest.getRequestId());
+ topologyRequest.setCommonData(optimizerRequest.getCommonData());
+ topologyRequest.setElements(getElementCriteria(optimizerRequest));
+ topologyRequest.setPolicies(getPolicies(optimizerRequest));
+ try {
+ topologyResponse = initiateTopology(topologyRequest, topology, request);
+ } catch (Exception e) {
+ topologyResponse.setStatus(TopologyRequestStatus.FAILED);
+ topologyResponse.setErrorMessage(LogMessages.UNEXPECTED_EXCEPTION.format(e.getMessage()));
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ }
+ return topologyResponse;
}
private List<TopologyPolicyInfo> getPolicies(OptimizerRequest optimizerRequest) {
@@ -131,19 +141,20 @@ public class TopologyClient {
return list;
}
- private TopologyResponse initiateTopology(TopologyRequest request, Topology topology, Request requestRow) throws CmsoException, JsonProcessingException {
+ private TopologyResponse initiateTopology(TopologyRequest request, Topology topology, Request requestRow)
+ throws CmsoException, JsonProcessingException {
String url = env.getProperty("cmso.topology.create.request.url");
String username = env.getProperty("mechid.user");
String password = pm.getProperty("mechid.pass", "");
Client client = ClientBuilder.newClient();
client.register(new BasicAuthenticatorFilter(username, password));
client.register(new CmsoClientFilters());
- WebTarget webTarget = client.target(url);
- Invocation.Builder invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
debug.debug("topology url / user: " + url + " / " + username);
debug.debug("topology Request: " + new ObjectMapper().writeValueAsString(request));
Observation.report(LogMessages.TOPOLOGY_REQUEST, "Begin", request.getRequestId(), url);
topology.setTopologyStart(System.currentTimeMillis());
+ WebTarget webTarget = client.target(url);
+ Invocation.Builder invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
Response response = invocationBuilder.post(Entity.json(request));
Observation.report(LogMessages.TOPOLOGY_REQUEST, "End", request.getRequestId(), url);
TopologyResponse topologyResponse = null;
@@ -153,11 +164,11 @@ public class TopologyClient {
break;
case 200:
debug.debug("Successfully retrieved topology: " + request.getRequestId());
- topologyResponse = processTopologyResponse(request, response, topology, requestRow);
+ topologyResponse = processTopologyResponse(request, response, topology, requestRow);
break;
default:
- throw new CmsoException(Status.INTERNAL_SERVER_ERROR, LogMessages.UNEXPECTED_RESPONSE,
- url, response.getStatusInfo().toString());
+ throw new CmsoException(Status.INTERNAL_SERVER_ERROR, LogMessages.UNEXPECTED_RESPONSE, url,
+ response.getStatusInfo().toString());
}
return topologyResponse;
}
@@ -168,9 +179,8 @@ public class TopologyClient {
TopologyResponse topologyResponse = null;
try {
topologyResponse = new ObjectMapper().readValue(responseString, TopologyResponse.class);
- }
- catch (Exception e)
- {
+ topology.setTopology(responseString);
+ } catch (Exception e) {
Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
topologyResponse = new TopologyResponse();
topologyResponse.setRequestId(request.getRequestId());
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyRequestManager.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyRequestManager.java
index 3120e0d..ce0d583 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyRequestManager.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/TopologyRequestManager.java
@@ -21,11 +21,7 @@ package org.onap.optf.cmso.optimizer.clients.topology;
import java.util.Optional;
import java.util.UUID;
-import javax.ws.rs.core.Response.Status;
-import org.onap.observations.Observation;
-import org.onap.optf.cmso.common.exceptions.CmsoException;
import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyResponse;
-import org.onap.optf.cmso.optimizer.common.LogMessages;
import org.onap.optf.cmso.optimizer.model.Request;
import org.onap.optf.cmso.optimizer.model.Topology;
import org.onap.optf.cmso.optimizer.model.dao.RequestDao;
@@ -34,6 +30,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+/**
+ * The Class TopologyRequestManager.
+ */
@Component
public class TopologyRequestManager {
@@ -49,52 +48,37 @@ public class TopologyRequestManager {
@Autowired
TopologyClient topologyClient;
- public TopologyResponse createTopologyRequest(UUID uuid)
- {
- try
- {
- Request request = null;
- Optional<Request> requestOptional = requestDao.findById(uuid);
- if (requestOptional.isPresent())
- {
- request = requestOptional.get();
- }
- if (request == null)
- {
- throw new CmsoException(Status.INTERNAL_SERVER_ERROR, LogMessages.EXPECTED_DATA_NOT_FOUND,
- uuid.toString(), "Request table");
- }
- Topology topology = null;
- Optional<Topology> topologyOpt = topologyDao.findById(uuid);
- if (topologyOpt.isPresent())
- {
- topology = topologyOpt.get();
-
- }
- if (topology == null)
- {
- topology = new Topology();
- topology.setUuid(uuid);
- topology.setTopologyRetries(0);
- }
- TopologyResponse topologyResponse = topologyClient.makeRequest(request, topology);
- switch(topologyResponse.getStatus())
- {
- case COMPLETED:
- break;
- case FAILED:
- break;
- case IN_PROGRESS:
- break;
- }
- return topologyResponse;
+ /**
+ * Creates the topology request.
+ *
+ * @param requestRow the request row
+ * @return the topology response
+ */
+ public TopologyResponse createTopologyRequest(Request requestRow) {
+ Topology topology = getExistingTopology(requestRow.getUuid());
+ if (topology == null) {
+ topology = new Topology();
+ topology.setUuid(requestRow.getUuid());
+ topology.setTopologyRetries(0);
}
- catch (Exception e)
- {
- Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
- }
- return null;
+ TopologyResponse topologyResponse = topologyClient.makeRequest(requestRow, topology);
+ topologyDao.save(topology);
+ return topologyResponse;
}
+
+ /**
+ * Gets the existing topology.
+ *
+ * @param uuid the uuid
+ * @return the existing topology
+ */
+ public Topology getExistingTopology(UUID uuid) {
+ Optional<Topology> topologyOpt = topologyDao.findById(uuid);
+ if (topologyOpt.isPresent()) {
+ return topologyOpt.get();
+ }
+ return null;
+ }
}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/TopologyRequest.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/TopologyRequest.java
index e0e95f7..ff6df18 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/TopologyRequest.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/TopologyRequest.java
@@ -35,6 +35,7 @@ import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
+import org.onap.optf.cmso.optimizer.clients.common.models.ElementCriteria;
import org.onap.optf.cmso.optimizer.service.rs.models.NameValue;
@ApiModel(value = "Topology Request",
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/LogMessages.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/LogMessages.java
index b61b02a..f36caee 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/LogMessages.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/common/LogMessages.java
@@ -37,6 +37,9 @@ import javax.ws.rs.core.Response.Status;
import org.apache.log4j.Level;
import org.onap.observations.ObservationInterface;
+/**
+ * The Enum LogMessages.
+ */
public enum LogMessages implements ObservationInterface {
OPTIMIZE_SCHEDULE("Optimize schedule {0} : {1}: {2} : {3}", Status.OK, Level.INFO),
@@ -60,7 +63,8 @@ public enum LogMessages implements ObservationInterface {
OUTGOING_MESSAGE_RETURNED("Outgoing message returned method={0} path={1} status={2}", Status.OK, Level.INFO, true,
false),
- UNEXPECTED_RESPONSE("Unexpected response from URL {0} : HTTP Status={1}", Status.INTERNAL_SERVER_ERROR , Level.ERROR),
+ UNEXPECTED_RESPONSE("Unexpected response from URL {0} : HTTP Status={1}", Status.INTERNAL_SERVER_ERROR,
+ Level.ERROR),
INVALID_CHANGE_WINDOW("Change window end time {0} must be after start time {1}", Status.OK, Level.INFO),
EXPECTED_EXCEPTION("Expected exception encountered during processing. {0}", Status.OK, Level.INFO),
UNABLE_TO_UPDATE_TICKET("Unable to update change ticket in TM: Schedule ID: {0} : changeid: {1} : Reason: {2}",
@@ -73,6 +77,14 @@ public enum LogMessages implements ObservationInterface {
OPTIMIZER_REQUEST("OPtimizer request {0} for {1} Command: {1}", Status.OK, Level.INFO),
TICKETS_REQUEST("Tickets request {0} for {1} URL: {1}", Status.OK, Level.INFO),
UNSUPPORTED_PERIODIC_TIME("Unsupported periodic time from policy: {0}", Status.INTERNAL_SERVER_ERROR, Level.ERROR),
+ EXCEEDED_RETRY_LIMIT("Outbound request for {0} exceeded retry limit {1}", Status.INTERNAL_SERVER_ERROR,
+ Level.ERROR),
+ FAILED_TO_CREATE_TOPOLOGY_REQUEST("Failed to create request reqeust for id={0}", Status.INTERNAL_SERVER_ERROR,
+ Level.ERROR),
+ FAILED_TO_CREATE_TICKET_REQUEST("Failed to create ticket request for id={0}", Status.INTERNAL_SERVER_ERROR,
+ Level.ERROR),
+ FAILED_TO_CREATE_OPTIMIZER_REQUEST("Failed to create optimizer request for id={0}", Status.INTERNAL_SERVER_ERROR,
+ Level.ERROR),
;
private final String defaultId;
@@ -147,43 +159,88 @@ public enum LogMessages implements ObservationInterface {
}
+ /**
+ * Gets the level.
+ *
+ * @return the level
+ */
// interface methods
@Override
public Level getLevel() {
return level;
}
+ /**
+ * Gets the message.
+ *
+ * @return the message
+ */
@Override
public String getMessage() {
return defaultMessage;
}
+ /**
+ * Gets the status.
+ *
+ * @return the status
+ */
@Override
public Status getStatus() {
return status;
}
+ /**
+ * Gets the value.
+ *
+ * @return the value
+ */
@Override
public Enum<?> getValue() {
return this;
}
+ /**
+ * Gets the domain.
+ *
+ * @return the domain
+ */
@Override
public String getDomain() {
return this.getClass().getSimpleName();
}
+ /**
+ * Gets the audit.
+ *
+ * @return the audit
+ */
@Override
public Boolean getAudit() {
return audit;
}
+ /**
+ * Gets the metric.
+ *
+ * @return the metric
+ */
@Override
public Boolean getMetric() {
return metric;
}
/**
+ * Format.
+ *
+ * @param args the args
+ * @return the string
+ */
+ public String format(String... args) {
+ return EELFResourceManager.format(this, args);
+ }
+
+ /**
* The main method.
*
* @param argv the arguments
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/core/OptimizerManager.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/core/OptimizerManager.java
index 5289dae..43ecf3f 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/core/OptimizerManager.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/core/OptimizerManager.java
@@ -26,6 +26,8 @@ import java.util.Optional;
import java.util.UUID;
import javax.ws.rs.core.Response.Status;
import org.onap.optf.cmso.common.exceptions.CmsoException;
+import org.onap.optf.cmso.optimizer.clients.ticketmgt.TicketMgtRequestManager;
+import org.onap.optf.cmso.optimizer.clients.ticketmgt.models.ActiveTicketsResponse;
import org.onap.optf.cmso.optimizer.clients.topology.TopologyRequestManager;
import org.onap.optf.cmso.optimizer.clients.topology.models.TopologyResponse;
import org.onap.optf.cmso.optimizer.common.LogMessages;
@@ -39,6 +41,9 @@ import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerResponse.Optimize
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+/**
+ * The Class OptimizerManager.
+ */
@Component
public class OptimizerManager {
@@ -48,6 +53,9 @@ public class OptimizerManager {
@Autowired
TopologyRequestManager topologyRequestManager;
+ @Autowired
+ TicketMgtRequestManager ticketMgtRequestManager;
+
/**
* Validate optimizer request.
*
@@ -111,12 +119,18 @@ public class OptimizerManager {
throw new CmsoException(Status.BAD_REQUEST, LogMessages.MISSING_REQUIRED_ATTRIBUTE, name);
}
+ /**
+ * Process optimizer request.
+ *
+ * @param request the request
+ * @return the optimizer response
+ * @throws CmsoException the cmso exception
+ */
public OptimizerResponse processOptimizerRequest(OptimizerRequest request) throws CmsoException {
UUID uuid = UUID.fromString(request.getRequestId());
Request requestRow = null;
Optional<Request> rrOptional = requestDao.findById(uuid);
- if (rrOptional.isPresent())
- {
+ if (rrOptional.isPresent()) {
requestRow = rrOptional.get();
}
OptimizerResponse optimizerResponse = new OptimizerResponse();
@@ -135,39 +149,84 @@ public class OptimizerManager {
}
requestRow.setStatus(OptimizeScheduleStatus.FAILED.toString());
requestDao.save(requestRow);
- TopologyResponse topologyResponse = topologyRequestManager.createTopologyRequest(uuid);
+ initiateDataGathering(requestRow);
+ requestDao.save(requestRow);
+ OptimizeScheduleStatus status = OptimizeScheduleStatus.valueOf(requestRow.getStatus());
+ optimizerResponse.setStatus(status);
+ optimizerResponse.setErrorMessage("");
+ return optimizerResponse;
+ }
+
+ private void initiateDataGathering(Request requestRow) throws CmsoException {
+ TopologyResponse topologyResponse = topologyRequestManager.createTopologyRequest(requestRow);
if (topologyResponse != null) {
- switch (topologyResponse.getStatus())
- {
+ switch (topologyResponse.getStatus()) {
case COMPLETED:
requestRow.setRequestStart(System.currentTimeMillis());
requestRow.setStatus(OptimizeScheduleStatus.PENDING_TICKETS.toString());
- optimizerResponse.setStatus(OptimizeScheduleStatus.PENDING_TICKETS);
+ initiateTicketGathering(requestRow); // continue synchronous flow
+ return;
+ case FAILED:
+ requestRow.setRequestStart(System.currentTimeMillis());
+ requestRow.setRequestEnd(System.currentTimeMillis());
+ requestRow.setStatus(OptimizeScheduleStatus.FAILED.toString());
+ requestRow.setMessage(topologyResponse.getErrorMessage());
+ return;
+ case IN_PROGRESS:
+ requestRow.setRequestStart(System.currentTimeMillis());
+ requestRow.setStatus(OptimizeScheduleStatus.PENDING_TOPOLOGY.toString());
+ break;
+ default:
+ break;
+ }
+ }
+ throw new CmsoException(Status.INTERNAL_SERVER_ERROR, LogMessages.FAILED_TO_CREATE_TOPOLOGY_REQUEST,
+ requestRow.getUuid().toString());
+ }
+ private void initiateTicketGathering(Request requestRow) throws CmsoException {
+ ActiveTicketsResponse apiResponse = ticketMgtRequestManager.createTicketsRequest(requestRow);
+ if (apiResponse != null) {
+ switch (apiResponse.getStatus()) {
+ case COMPLETED:
+ requestRow.setRequestStart(System.currentTimeMillis());
+ requestRow.setStatus(OptimizeScheduleStatus.PENDING_OPTIMIZER.toString());
+ initiateOptimizer(requestRow);
break;
case FAILED:
requestRow.setRequestStart(System.currentTimeMillis());
requestRow.setRequestEnd(System.currentTimeMillis());
requestRow.setStatus(OptimizeScheduleStatus.FAILED.toString());
- optimizerResponse.setStatus(OptimizeScheduleStatus.FAILED);
- optimizerResponse.setErrorMessage(topologyResponse.getErrorMessage());
+ requestRow.setMessage(apiResponse.getErrorMessage());
break;
case IN_PROGRESS:
requestRow.setRequestStart(System.currentTimeMillis());
- requestRow.setStatus(OptimizeScheduleStatus.PENDING_TOPOLOGY.toString());
- optimizerResponse.setStatus(OptimizeScheduleStatus.PENDING_TOPOLOGY);
+ requestRow.setStatus(OptimizeScheduleStatus.PENDING_TICKETS.toString());
+ break;
+ default:
break;
}
- } else {
- requestRow.setRequestStart(System.currentTimeMillis());
- requestRow.setStatus(OptimizeScheduleStatus.PENDING_TOPOLOGY.toString());
- requestDao.save(requestRow);
- return null;
}
- requestDao.save(requestRow);
- return optimizerResponse;
+ throw new CmsoException(Status.INTERNAL_SERVER_ERROR, LogMessages.FAILED_TO_CREATE_TICKET_REQUEST,
+ requestRow.getUuid().toString());
}
+ private void initiateOptimizer(Request requestRow) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @SuppressWarnings("unused")
+ private Request getRequestRow(UUID uuid) throws CmsoException {
+ Request requestRow = null;
+ Optional<Request> requestOptional = requestDao.findById(uuid);
+ if (requestOptional.isPresent()) {
+ return requestOptional.get();
+ }
+ throw new CmsoException(Status.INTERNAL_SERVER_ERROR, LogMessages.EXPECTED_DATA_NOT_FOUND,
+ requestRow.toString(), "Request table");
+ }
+
}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/model/Request.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/model/Request.java
index 3258c15..3ae723f 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/model/Request.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/model/Request.java
@@ -54,6 +54,9 @@ public class Request implements Serializable {
private String status;
+ @Lob
+ private String message;
+
public Request() {}
public UUID getUuid() {
@@ -104,4 +107,12 @@ public class Request implements Serializable {
this.status = status;
}
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java
index 30104f4..d0af5c4 100644
--- a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java
@@ -36,6 +36,9 @@ import java.io.Serializable;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
+/**
+ * The Class ChangeWindow.
+ */
@ApiModel(value = "Change Window", description = "Time window for which tickets are to returned")
public class ChangeWindow implements Serializable {
private static final long serialVersionUID = 1L;
@@ -49,23 +52,84 @@ public class ChangeWindow implements Serializable {
@DateTimeFormat(pattern = "yyyy-MM-dd'T'hh:mm:ss'Z'")
private Date endTime;
+ /**
+ * Gets the start time.
+ *
+ * @return the start time
+ */
public Date getStartTime() {
return startTime;
}
+ /**
+ * Sets the start time.
+ *
+ * @param startTime the new start time
+ */
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
+ /**
+ * Gets the end time.
+ *
+ * @return the end time
+ */
public Date getEndTime() {
return endTime;
}
+ /**
+ * Sets the end time.
+ *
+ * @param endTime the new end time
+ */
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
/**
+ * Overlaps test instance.b
+ *
+ * @param test the test window
+ * @return true, if successful
+ */
+ public boolean overlaps(ChangeWindow test) {
+ int start = startTime.compareTo(test.getStartTime());
+ int end = endTime.compareTo(test.getEndTime());
+ int startend = startTime.compareTo(test.getEndTime());
+ int endstart = endTime.compareTo(test.getStartTime());
+ // at least one of the ends match up
+ if (start == 0 || end == 0 || startend == 0 || endstart == 0) {
+ return true;
+ }
+ // end is before start or start is before end, cannot overlap
+ if (endstart == -1 || startend == 1) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Absorb if overlapping window.
+ *
+ * @param test the test window
+ * @return true, if successful
+ */
+ public boolean absorbIfOverlapping(ChangeWindow test) {
+ if (overlaps(test)) {
+ if (test.getStartTime().before(getStartTime())) {
+ setStartTime(test.getStartTime());
+ }
+ if (test.getEndTime().after(getEndTime())) {
+ setEndTime(test.getEndTime());
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
* To string.
*
* @return the string
diff --git a/cmso-optimizer/src/test/java/org/onap/optf/cmso/AuthProviderTest.java b/cmso-optimizer/src/test/java/org/onap/optf/cmso/AuthProviderTest.java
index 8047f9e..d2852d2 100644
--- a/cmso-optimizer/src/test/java/org/onap/optf/cmso/AuthProviderTest.java
+++ b/cmso-optimizer/src/test/java/org/onap/optf/cmso/AuthProviderTest.java
@@ -36,7 +36,6 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
@@ -66,4 +65,4 @@ public class AuthProviderTest {
assertTrue(authProvider.supports(UsernamePasswordAuthenticationToken.class));
assertFalse(authProvider.supports(Authentication.class));
}
-} \ No newline at end of file
+}
diff --git a/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManagerTest.java b/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManagerTest.java
index 7874501..c71c829 100644
--- a/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManagerTest.java
+++ b/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/policies/PolicyManagerTest.java
@@ -18,6 +18,7 @@
*/
package org.onap.optf.cmso.optimizer.availability.policies;
+
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
@@ -33,8 +34,7 @@ import org.onap.optf.cmso.optimizer.availability.policies.model.TimeLimitAndVert
import org.springframework.core.env.Environment;
@RunWith(MockitoJUnitRunner.class)
-public class PolicyManagerTest
-{
+public class PolicyManagerTest {
@InjectMocks
private PolicyManager policyManager;
@@ -52,12 +52,11 @@ public class PolicyManagerTest
public void getPolicyByName() {
String policyName = "Weekday_00_06";
- String result = "CMSO.Weekday_00_06,";
+ String result = "CMSO.Weekday_00_06,CMSO.Weekday_00_06,CMSO.Weekday_00_06,";
List<Policy> policies = policyManager.getSupportedPolicies();
StringBuilder sb = new StringBuilder();
- for (Policy pol : policies)
- {
- sb.append(pol.getPolicyName()).append("," );
+ for (Policy pol : policies) {
+ sb.append(pol.getPolicyName()).append(",");
}
System.out.println(" String result = \"" + sb.toString() + "\";");
Assert.assertTrue(result.equals(sb.toString()));
@@ -67,4 +66,4 @@ public class PolicyManagerTest
Assert.assertTrue(top != null);
}
-} \ No newline at end of file
+}
diff --git a/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindowsTest.java b/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindowsTest.java
new file mode 100644
index 0000000..ce1f1a4
--- /dev/null
+++ b/cmso-optimizer/src/test/java/org/onap/optf/cmso/optimizer/availability/timewindows/RecurringWindowsTest.java
@@ -0,0 +1,79 @@
+/*
+ * ============LICENSE_START==============================================
+ * Copyright (c) 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.
+ * ============LICENSE_END=================================================
+ *
+ */
+
+package org.onap.optf.cmso.optimizer.availability.timewindows;
+
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.optf.cmso.optimizer.availability.policies.PolicyManager;
+import org.onap.optf.cmso.optimizer.availability.policies.model.TimeLimitAndVerticalTopology;
+import org.onap.optf.cmso.optimizer.service.rs.models.ChangeWindow;
+import org.springframework.core.env.Environment;
+
+@RunWith(MockitoJUnitRunner.class)
+public class RecurringWindowsTest {
+
+
+ @InjectMocks
+ private PolicyManager policyManager;
+
+ @Mock
+ public Environment env;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ Mockito.when(env.getProperty("cmso.local.policy.folder", "data/policies")).thenReturn("data/policies");
+ }
+
+ @Test
+ public void getAvailabilityWindowsForPolicies() {
+ getAvailabilityWindowsForPolicy("Weekday_00_06", "2019-03-08T00:00:00.00Z", "2019-03-12T00:00:00.00Z", 2);
+ getAvailabilityWindowsForPolicy("EveryDay_00_06", "2019-03-08T00:00:00.00Z", "2019-03-12T00:00:00.00Z", 4);
+ getAvailabilityWindowsForPolicy("Weekend_00_06", "2019-03-08T00:00:00.00Z", "2019-03-12T00:00:00.00Z", 3);
+
+ }
+
+ private void getAvailabilityWindowsForPolicy(String policyName, String startStr, String endStr, int size) {
+ TimeLimitAndVerticalTopology top = policyManager.getTimeLimitAndVerticalTopologyByName(policyName);
+ Assert.assertTrue(top != null);
+ List<TimeLimitAndVerticalTopology> topList = new ArrayList<>();
+ topList.add(top);
+ ChangeWindow changeWindow = new ChangeWindow();
+ Instant start = Instant.parse(startStr);
+ Instant end = Instant.parse(endStr);
+ changeWindow.setStartTime(Date.from(start));
+ changeWindow.setEndTime(Date.from(end));
+ List<ChangeWindow> windows = RecurringWindows.getAvailabilityWindowsForPolicies(topList, changeWindow);
+ Assert.assertTrue(windows != null);
+ Assert.assertTrue(windows.size() == size);
+
+ }
+}
diff --git a/cmso-optimizer/src/test/java/org/onap/optf/cmso/service/rs/MockHttpServletRequest.java b/cmso-optimizer/src/test/java/org/onap/optf/cmso/service/rs/MockHttpServletRequest.java
index 84e66c1..f7d0939 100644
--- a/cmso-optimizer/src/test/java/org/onap/optf/cmso/service/rs/MockHttpServletRequest.java
+++ b/cmso-optimizer/src/test/java/org/onap/optf/cmso/service/rs/MockHttpServletRequest.java
@@ -21,7 +21,6 @@ package org.onap.optf.cmso.service.rs;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
import javax.servlet.http.HttpServletRequest;
public class MockHttpServletRequest {
diff --git a/cmso-service/etc/config/optimizer.properties b/cmso-service/etc/config/optimizer.properties
index 541946e..aa79e8a 100644
--- a/cmso-service/etc/config/optimizer.properties
+++ b/cmso-service/etc/config/optimizer.properties
@@ -30,11 +30,11 @@
#-------------------------------------------------------------------------------
## Loopback
-cmso.optimizer.request.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule
-cmso.optimizer.status.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule
-cmso.optimizer.health.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule/health
+#cmso.optimizer.request.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule
+#cmso.optimizer.status.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule
+#cmso.optimizer.health.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule/health
## Local optimizer service
-#cmso.optimizer.request.url=http://127.0.0.1:7997/optimizer/v1/optimize/schedule
-#cmso.optimizer.status.url=http://127.0.0.1:7997/optimizer/v1/optimize/schedule
-#cmso.optimizer.health.url=http://127.0.0.1:7997/optimizer/v1/health?checkInterfaces=true
+cmso.optimizer.request.url=http://127.0.0.1:7997/optimizer/v1/optimize/schedule
+cmso.optimizer.status.url=http://127.0.0.1:7997/optimizer/v1/optimize/schedule
+cmso.optimizer.health.url=http://127.0.0.1:7997/optimizer/v1/health?checkInterfaces=true
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 028241c..2543c77 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,27 +1,27 @@
/*
* 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.
@@ -65,11 +65,13 @@ public class ChangeManagementDetailDAOImpl implements ChangeManagementDetailDAO
+ " left outer join APPROVAL_TYPES at on sa.approval_types_uuid = at.uuid ");
sql.append(where);
sql.append(" order by uuid ");
- if (limit > 0)
+ if (limit > 0) {
sql.append("LIMIT " + limit);
+ }
- Query q = manager.createNativeQuery(sql.toString(), ChangeManagementDetail.class);
- List<ChangeManagementDetail> list = q.getResultList();
+ Query query = manager.createNativeQuery(sql.toString(), ChangeManagementDetail.class);
+ @SuppressWarnings("unchecked")
+ List<ChangeManagementDetail> list = query.getResultList();
return list;
}
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java
index 4db44f6..1c3505e 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java
@@ -180,8 +180,7 @@ public class CmsoOptimizerClient {
debug.debug("Successfully scheduled optimization: " + schedule.getScheduleId());
// Scheduled with optimizer
break;
- case 400: // Bad request
- {
+ case 400: {
schedule.setOptimizerDateTimeMillis(System.currentTimeMillis());
schedule.setOptimizerStatus("HTTP Status: " + response.getStatus());
String message = response.readEntity(String.class);
@@ -287,8 +286,7 @@ public class CmsoOptimizerClient {
debug.debug("Successfully retrieved optimization: " + schedule.getScheduleId());
optimizerHandler.handleOptimizerResponse(optimizerResponse, schedule);
break;
- default: // Bad request
- {
+ default: {
schedule.setOptimizerDateTimeMillis(System.currentTimeMillis());
schedule.setOptimizerStatus("HTTP Status: " + response.getStatus());
String message = response.readEntity(String.class);
@@ -336,8 +334,7 @@ public class CmsoOptimizerClient {
return null;
}
- private List<OptimizerElementInfo> marshallElements(SchedulingData info)
- {
+ private List<OptimizerElementInfo> marshallElements(SchedulingData info) {
List<OptimizerElementInfo> list = new ArrayList<>();
List<ElementInfo> elementList = info.getElements();
for (ElementInfo element : elementList) {
@@ -345,7 +342,7 @@ public class CmsoOptimizerClient {
optElement.setElementData(element.getElementData());
optElement.setElementId(element.getElementId());
optElement.setGroupId(element.getGroupId());
- list.add(optElement );
+ list.add(optElement);
}
return list;
}
@@ -375,6 +372,7 @@ public class CmsoOptimizerClient {
/**
* Health check.
+ *
* @return
*/
public HealthCheckComponent healthCheck() {
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 48d6e73..71a2092 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
@@ -66,10 +66,9 @@ public class OptimizerQuartzJob extends QuartzJobBean {
private static EELFLogger log = EELFManager.getInstance().getLogger(OptimizerQuartzJob.class);
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
- private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();
@Autowired
- ScheduleDAO scheduleDAO;
+ ScheduleDAO scheduleDao;
@Autowired
PropertiesManagement pm;
@@ -88,20 +87,20 @@ public class OptimizerQuartzJob extends QuartzJobBean {
// return;
try {
- // This job will look at the schedules waiting to go to Optimizer or waiting on response from optimizer
+ // This job will look at the schedules waiting to go to Optimizer or waiting on response from
+ // optimizer
// (PendingSchedule, PendingOptimizer),
// schedule the request and update the status to PendingSchedule
// and update the state to OptimizationInProgress
- List<Schedule> schedules = scheduleDAO.findByDomainStatus(DomainsEnum.ChangeManagement.toString(),
- CMSStatusEnum.PendingSchedule.toString());
+ List<Schedule> schedules = scheduleDao.findByDomainStatus(DomainsEnum.ChangeManagement.toString(),
+ CMSStatusEnum.PendingSchedule.toString());
for (Schedule s : schedules) {
scheduleOptimization(s);
}
- List<Schedule> inProgressSchedules = scheduleDAO.findByDomainStatus(DomainsEnum.ChangeManagement.toString(),
- CMSStatusEnum.OptimizationInProgress.toString());
- for (Schedule s : inProgressSchedules)
- {
- scheduleOptimization(s);
+ List<Schedule> inProgressSchedules = scheduleDao.findByDomainStatus(DomainsEnum.ChangeManagement.toString(),
+ CMSStatusEnum.OptimizationInProgress.toString());
+ for (Schedule s : inProgressSchedules) {
+ scheduleOptimization(s);
}
} catch (Exception e) {
@@ -136,7 +135,7 @@ public class OptimizerQuartzJob extends QuartzJobBean {
default: {
throw new SchedulerException(
- "Invalid return from dispach service: " + url + " : " + response.toString());
+ "Invalid return from dispach service: " + url + " : " + response.toString());
}
}
} catch (Exception e) {
@@ -149,18 +148,17 @@ public class OptimizerQuartzJob extends QuartzJobBean {
}
/**
- * According to the documentation I read, Quartz would queue a job without
- * waiting for the completion of the job with @DisallowConcurrentExecution to
- * complete so that there would be a backlog of triggers to process
+ * According to the documentation I read, Quartz would queue a job without waiting for the
+ * completion of the job with @DisallowConcurrentExecution to complete so that there would be a
+ * backlog of triggers to process
*
- * This was designed to spin though these stale triggers. When this didn't work,
- * I discovered that the behavior is that Quartz will wait for the appropriate
- * interval after @DisallowConcurrentExecution jobs complete.
+ * This was designed to spin though these stale triggers. When this didn't work, I discovered that
+ * the behavior is that Quartz will wait for the appropriate interval
+ * after @DisallowConcurrentExecution jobs complete.
*
* I tested by adding a sleep for an interval > the trigger interval
*
- * QUartz appears to do what makes sense. Leaving this here in case issues
- * arise...
+ * QUartz appears to do what makes sense. Leaving this here in case issues arise...
*
*/
@SuppressWarnings("unused")
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/model/OptimizerRequest.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/model/OptimizerRequest.java
index 144f9db..47449f0 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/model/OptimizerRequest.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/model/OptimizerRequest.java
@@ -36,7 +36,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.onap.optf.cmso.service.rs.models.v2.ChangeWindow;
-import org.onap.optf.cmso.service.rs.models.v2.ElementInfo;
import org.onap.optf.cmso.service.rs.models.v2.NameValue;
import org.onap.optf.cmso.service.rs.models.v2.PolicyInfo;
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
index 377c250..290d21e 100644
--- 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
@@ -43,6 +43,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
@Controller
public class CmsoOptimizedScheduleServiceImpl extends CommonServiceImpl implements CmsoOptimizedScheduleService {
+ @SuppressWarnings("unused")
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@Autowired
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizerCallbackImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizerCallbackImpl.java
index 1596051..6abb6bb 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizerCallbackImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmsoOptimizerCallbackImpl.java
@@ -69,8 +69,6 @@ import org.springframework.stereotype.Controller;
@Controller
public class CmsoOptimizerCallbackImpl extends BaseSchedulerServiceImpl implements CmsoOptimizerCallback {
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();
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 57a0751..02b803f 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
@@ -96,25 +96,25 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService {
Environment env;
@Autowired
- ChangeManagementScheduleDAO cmScheduleDAO;
+ ChangeManagementScheduleDAO cmScheduleDao;
@Autowired
- ChangeManagementGroupDAO cmGroupDAO;
+ ChangeManagementGroupDAO cmGroupDao;
@Autowired
- ChangeManagementChangeWindowDAO cmChangeWindowDAO;
+ ChangeManagementChangeWindowDAO cmChangeWindowDao;
@Autowired
- ChangeManagementDetailDAO cmDetailsDAO;
+ ChangeManagementDetailDAO cmDetailsDao;
@Autowired
- ScheduleQueryDAO scheduleQueryDAO;
+ ScheduleQueryDAO scheduleQueryDao;
@Autowired
- ScheduleDAO scheduleDAO;
+ ScheduleDAO scheduleDao;
@Autowired
- ElementDataDAO elementDataDAO;
+ ElementDataDAO elementDataDao;
@Autowired
TmClient tmClient;
@@ -137,22 +137,22 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService {
int maxRows = 0;
// MultivaluedMap<String, String> qp = uri.getQueryParameters();
// buildWhere(qp, where);
- List<ScheduleQuery> list = scheduleQueryDAO.searchSchedules(where.toString(), maxRows);
+ List<ScheduleQuery> list = scheduleQueryDao.searchSchedules(where.toString(), maxRows);
if (list == null || !list.iterator().hasNext()) {
throw new CMSException(Status.NOT_FOUND, LogMessages.SCHEDULE_NOT_FOUND,
DomainsEnum.ChangeManagement.toString(), scheduleId);
}
Iterator<ScheduleQuery> iter = list.iterator();
while (iter.hasNext()) {
- Schedule sch = scheduleDAO.findById(iter.next().getUuid()).orElse(null);
+ Schedule sch = scheduleDao.findById(iter.next().getUuid()).orElse(null);
if (sch != null) {
schedules.add(sch);
if (includeDetails) {
- List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(sch.getUuid());
+ List<ChangeManagementGroup> groups = cmGroupDao.findBySchedulesID(sch.getUuid());
sch.setGroups(groups);
for (ChangeManagementGroup g : groups) {
List<ChangeManagementSchedule> cmSchedules =
- cmScheduleDAO.findByChangeManagementGroupId(g.getUuid());
+ cmScheduleDao.findByChangeManagementGroupId(g.getUuid());
g.setChangeManagementSchedules(cmSchedules);
}
}
@@ -208,8 +208,10 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService {
List<Map<String, String>> smdd = sm.getDomainData();
for (Map<String, String> map : smdd) {
for (String name : map.keySet()) {
- NameValue nv = new NameValue(name, map.get(name));
- dd.add(nv);
+ if (!name.equals(CmDomainDataEnum.CallbackData.toString())) {
+ NameValue nv = new NameValue(name, map.get(name));
+ dd.add(nv);
+ }
}
}
osm.setCommonData(dd);
@@ -285,7 +287,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService {
Response response = null;
Observation.report(LogMessages.DELETE_SCHEDULE_REQUEST, "Received", request.getRemoteAddr(), scheduleId, "");
try {
- Schedule schedule = scheduleDAO.findByDomainScheduleID(DomainsEnum.ChangeManagement.toString(), scheduleId);
+ Schedule schedule = scheduleDao.findByDomainScheduleID(DomainsEnum.ChangeManagement.toString(), scheduleId);
if (schedule == null) {
throw new CMSNotFoundException(DomainsEnum.ChangeManagement.toString(), scheduleId);
}
@@ -312,7 +314,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService {
Observation.report(LogMessages.GET_SCHEDULE_REQUEST_INFO, "Received", request.getRemoteAddr(), scheduleId, "");
Schedule schedule = null;
try {
- schedule = scheduleDAO.findByDomainScheduleID(DomainsEnum.ChangeManagement.toString(), scheduleId);
+ schedule = scheduleDao.findByDomainScheduleID(DomainsEnum.ChangeManagement.toString(), scheduleId);
if (schedule == null) {
throw new CMSException(Status.NOT_FOUND, LogMessages.SCHEDULE_NOT_FOUND,
DomainsEnum.ChangeManagement.toString(), scheduleId);
@@ -339,7 +341,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService {
approval.toString());
try {
String domain = DomainsEnum.ChangeManagement.toString();
- Schedule sch = scheduleDAO.findByDomainScheduleID(domain, scheduleId);
+ Schedule sch = scheduleDao.findByDomainScheduleID(domain, scheduleId);
if (sch == null) {
throw new CMSNotFoundException(domain, scheduleId);
}
@@ -385,7 +387,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService {
maxRows = maxSchedules;
}
buildWhere(qp, where);
- List<ChangeManagementDetail> list = cmDetailsDAO.searchScheduleDetails(where.toString(), maxRows);
+ List<ChangeManagementDetail> list = cmDetailsDao.searchScheduleDetails(where.toString(), maxRows);
if (list == null || !list.iterator().hasNext()) {
throw new CMSException(Status.NOT_FOUND, LogMessages.SCHEDULE_NOT_FOUND,
DomainsEnum.ChangeManagement.toString(), scheduleId);
@@ -443,7 +445,7 @@ public class CmsoServiceImpl extends CommonServiceImpl implements CmsoService {
msg.setMsoStatus(cms.getMsoStatus());
msg.setMsoTimeMillis(cms.getMsoTimeMillis());
if (!scheduleMap.containsKey(cms.getSchedulesUuid())) {
- Schedule schedule = scheduleDAO.findById(cms.getSchedulesUuid()).orElse(null);
+ Schedule schedule = scheduleDao.findById(cms.getSchedulesUuid()).orElse(null);
if (schedule != null) {
// DO not innclude in the results
schedule.setScheduleInfo(null);
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 6f60248..6785646 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
@@ -48,7 +48,8 @@ import org.springframework.core.env.Environment;
import org.springframework.stereotype.Controller;
/**
- * @author jf9860
+ * Health check.
+ *
*
*/
@Controller
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSInfo.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSInfo.java
index 1f7e317..3d104d2 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSInfo.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSInfo.java
@@ -1,27 +1,27 @@
/*
- * 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.
* 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.
@@ -31,18 +31,18 @@
package org.onap.optf.cmso.service.rs.models;
-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;
+import java.io.Serializable;
+import java.util.List;
/**
* The persistent class for the approval_types database table.
- *
+ *
*/
@ApiModel(value = "Change Management Scheduling Info", description = "Details of schedule being requested")
public class CMSInfo implements Serializable {
@@ -61,12 +61,14 @@ public class CMSInfo implements Serializable {
private Integer concurrencyLimit;
@ApiModelProperty(
- value = "Name of schedule optimization policy used by the change management cmso optimizer to determine available time slot")
+ value = "Name of schedule optimization policy used by the"
+ + " change management cmso optimizer to determine available time slot")
private String policyId;
@ApiModelProperty(value = "Lists of the VNFs to be changed and the desired change windows")
private List<VnfDetailsMessage> vnfDetails;
+ @Override
public String toString() {
ObjectMapper mapper = new ObjectMapper();
try {
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSMessage.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSMessage.java
index afa4c44..cd8c946 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSMessage.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/models/CMSMessage.java
@@ -1,27 +1,27 @@
/*
- * 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.
* 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.
@@ -31,16 +31,16 @@
package org.onap.optf.cmso.service.rs.models;
-import java.io.Serializable;
-import org.onap.optf.cmso.common.LogMessages;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.ApiModel;
+import java.io.Serializable;
+import org.onap.optf.cmso.common.LogMessages;
/**
* The persistent class for the approval_types database table.
- *
+ *
*/
@ApiModel
public class CMSMessage extends ScheduleMessage implements Serializable {
diff --git a/cmso-topology/data/vnf1.json b/cmso-topology/data/vnf1.json
new file mode 100644
index 0000000..9e26dfe
--- /dev/null
+++ b/cmso-topology/data/vnf1.json
@@ -0,0 +1 @@
+{} \ No newline at end of file
diff --git a/cmso-topology/src/main/java/org/onap/optf/cmso/common/CmsoRequestError.java b/cmso-topology/src/main/java/org/onap/optf/cmso/common/CmsoRequestError.java
index 5cd258e..f644aca 100644
--- a/cmso-topology/src/main/java/org/onap/optf/cmso/common/CmsoRequestError.java
+++ b/cmso-topology/src/main/java/org/onap/optf/cmso/common/CmsoRequestError.java
@@ -26,8 +26,6 @@
package org.onap.optf.cmso.common;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.ArrayList;
@@ -35,7 +33,6 @@ import java.util.List;
public class CmsoRequestError implements Serializable {
private static final long serialVersionUID = 1L;
- private static EELFLogger log = EELFManager.getInstance().getLogger(CmsoRequestError.class);
@JsonProperty
RequestError requestError;
diff --git a/cmso-topology/src/main/java/org/onap/optf/cmso/topology/filters/CmsoClientFilters.java b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/filters/CmsoClientFilters.java
index 51d548e..248ea43 100644
--- a/cmso-topology/src/main/java/org/onap/optf/cmso/topology/filters/CmsoClientFilters.java
+++ b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/filters/CmsoClientFilters.java
@@ -28,8 +28,6 @@ package org.onap.optf.cmso.topology.filters;
import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
import java.io.IOException;
import javax.ws.rs.client.ClientRequestContext;
import javax.ws.rs.client.ClientRequestFilter;
@@ -40,7 +38,6 @@ import org.onap.observations.Mdc;
import org.onap.observations.MessageHeaders;
import org.onap.observations.MessageHeaders.HeadersEnum;
import org.onap.observations.Observation;
-import org.onap.optf.cmso.topology.Application;
import org.onap.optf.cmso.topology.common.LogMessages;
import org.slf4j.MDC;
import org.springframework.stereotype.Component;
@@ -49,7 +46,6 @@ import org.springframework.stereotype.Component;
@Component
public class CmsoClientFilters implements ClientRequestFilter, ClientResponseFilter {
- private static EELFLogger log = EELFManager.getInstance().getLogger(Application.class);
private static String appId = "cmso";
@Override