aboutsummaryrefslogtreecommitdiffstats
path: root/cmso-service/src/main
diff options
context:
space:
mode:
authorJerry Flood <jflood@att.com>2019-03-28 06:56:01 -0400
committerJerry Flood <jflood@att.com>2019-03-28 09:54:53 -0400
commitcfcffef907adf2e1e2abef402c6e7353cd6ed15d (patch)
treeb2333d7b3330fb96198df9c6dd93d09103ca7ce4 /cmso-service/src/main
parentd26503bae87cdf1f4e99fd503d094ad9a9e2bb9e (diff)
Updates to support Optimizer API
Issue-ID: OPTFRA-437 Change-Id: I0c74fd3a740d657af51ca115c0fdd7e96777561c Signed-off-by: Jerry Flood <jflood@att.com>
Diffstat (limited to 'cmso-service/src/main')
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java1
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java15
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmQuartzJob.java15
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoClientFilters.java3
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/CmsoOptimizerClient.java18
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/model/OptimizerElementInfo.java91
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/optimizer/model/OptimizerRequest.java6
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java4
8 files changed, 127 insertions, 26 deletions
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java
index 92bb3f3..e612734 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java
@@ -48,7 +48,6 @@ import org.springframework.transaction.annotation.Transactional;
@Controller
public class DispatcherServiceImpl implements DispacherService {
- private static EELFLogger log = EELFManager.getInstance().getLogger(DispatcherServiceImpl.class);
private static EELFLogger audit = EELFManager.getInstance().getAuditLogger();
private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java
index 0987f8b..86fa038 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CMSQueueJob.java
@@ -1,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.
@@ -61,7 +61,6 @@ import com.att.eelf.configuration.EELFManager;
*/
@Component
public class CMSQueueJob {
- private static EELFLogger log = EELFManager.getInstance().getLogger(CMSQueueJob.class);
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@Autowired
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmQuartzJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmQuartzJob.java
index f3d98b3..9e1159a 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmQuartzJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/eventq/CmQuartzJob.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.
@@ -52,7 +52,6 @@ import com.att.eelf.configuration.EELFManager;
@Component
@DisallowConcurrentExecution
public class CmQuartzJob extends QuartzJobBean {
- private static EELFLogger log = EELFManager.getInstance().getLogger(CmQuartzJob.class);
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@Autowired
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoClientFilters.java b/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoClientFilters.java
index 00b8fe5..3f040ae 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoClientFilters.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoClientFilters.java
@@ -32,8 +32,6 @@
package org.onap.optf.cmso.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;
@@ -51,7 +49,6 @@ import org.springframework.stereotype.Component;
@Component
public class CmsoClientFilters implements ClientRequestFilter, ClientResponseFilter {
- private static EELFLogger log = EELFManager.getInstance().getLogger(CmsoClientFilters.class);
private static String appId = "cmso";
@Override
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 d81c293..4db44f6 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
@@ -52,9 +52,11 @@ import org.onap.optf.cmso.filters.CmsoClientFilters;
import org.onap.optf.cmso.model.DomainData;
import org.onap.optf.cmso.model.Schedule;
import org.onap.optf.cmso.model.dao.ScheduleDAO;
+import org.onap.optf.cmso.optimizer.model.OptimizerElementInfo;
import org.onap.optf.cmso.optimizer.model.OptimizerRequest;
import org.onap.optf.cmso.optimizer.model.OptimizerResponse;
import org.onap.optf.cmso.service.rs.models.HealthCheckComponent;
+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.SchedulingData;
import org.springframework.beans.factory.annotation.Autowired;
@@ -315,7 +317,7 @@ public class CmsoOptimizerClient {
orequest.setPolicies(info.getPolicies());
orequest.setRequestId(schedule.getScheduleId());
orequest.setCommonData(marshallCommonData(schedule));
- orequest.setElements(info.getElements());
+ orequest.setElements(marshallElements(info));
orequest.setAdditionalDuration(info.getAdditionalDurationInSeconds());
orequest.setNormalDuration(info.getNormalDurationInSeconds());
orequest.setConcurrencyLimit(info.getConcurrencyLimit());
@@ -334,6 +336,20 @@ public class CmsoOptimizerClient {
return null;
}
+ private List<OptimizerElementInfo> marshallElements(SchedulingData info)
+ {
+ List<OptimizerElementInfo> list = new ArrayList<>();
+ List<ElementInfo> elementList = info.getElements();
+ for (ElementInfo element : elementList) {
+ OptimizerElementInfo optElement = new OptimizerElementInfo();
+ optElement.setElementData(element.getElementData());
+ optElement.setElementId(element.getElementId());
+ optElement.setGroupId(element.getGroupId());
+ list.add(optElement );
+ }
+ return list;
+ }
+
private List<NameValue> marshallCommonData(Schedule schedule) {
List<NameValue> nvList = new ArrayList<>();
List<DomainData> ddList = schedule.getDomainData();
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/model/OptimizerElementInfo.java b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/model/OptimizerElementInfo.java
new file mode 100644
index 0000000..50c5621
--- /dev/null
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/optimizer/model/OptimizerElementInfo.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ *
+ * 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.model;
+
+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.List;
+import org.onap.optf.cmso.service.rs.models.v2.NameValue;
+
+@ApiModel(value = "Optimizer Element", description = "Element to be scheduled.")
+public class OptimizerElementInfo implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(OptimizerElementInfo.class);
+
+ @ApiModelProperty(value = "Element identifier")
+ private String elementId;
+
+ @ApiModelProperty(value = "Implementation specific element data.")
+ public List<NameValue> elementData = new ArrayList<>();
+
+ @ApiModelProperty(value = "VNF group identifier.")
+ public String groupId;
+
+
+ public String getElementId() {
+ return elementId;
+ }
+
+ public void setElementId(String elementId) {
+ this.elementId = elementId;
+ }
+
+
+ public List<NameValue> getElementData() {
+ return elementData;
+ }
+
+ public void setElementData(List<NameValue> elementData) {
+ this.elementData = elementData;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ @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-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 058d8c1..144f9db 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
@@ -65,7 +65,7 @@ public class OptimizerRequest implements Serializable {
private List<ChangeWindow> changeWindows = new ArrayList<>();
@ApiModelProperty(value = "List of the elements to schedule.")
- private List<ElementInfo> elements = new ArrayList<>();
+ private List<OptimizerElementInfo> elements = new ArrayList<>();
@ApiModelProperty(value = "List of the policies to control optimization.")
private List<PolicyInfo> policies = new ArrayList<>();
@@ -100,12 +100,12 @@ public class OptimizerRequest implements Serializable {
}
- public List<ElementInfo> getElements() {
+ public List<OptimizerElementInfo> getElements() {
return elements;
}
- public void setElements(List<ElementInfo> elements) {
+ public void setElements(List<OptimizerElementInfo> elements) {
this.elements = elements;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java
index b179719..9be348a 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java
@@ -42,6 +42,7 @@ import org.joda.time.DateTime;
import org.onap.observations.Observation;
import org.onap.optf.cmso.common.LogMessages;
import org.onap.optf.cmso.common.PropertiesManagement;
+import org.onap.optf.cmso.optimizer.model.OptimizerElementInfo;
import org.onap.optf.cmso.optimizer.model.OptimizerRequest;
import org.onap.optf.cmso.optimizer.model.OptimizerResponse;
import org.onap.optf.cmso.optimizer.model.OptimizerScheduleInfo;
@@ -50,7 +51,6 @@ import org.onap.optf.cmso.optimizer.model.ScheduledElement.ScheduleType;
import org.onap.optf.cmso.optimizer.model.UnScheduledElement;
import org.onap.optf.cmso.service.rs.CmsoOptimizerCallbackImpl;
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.wf.bean.WfCmResponse200;
import org.onap.optf.cmso.wf.bean.WfMsoRequestReferences;
import org.onap.optf.cmso.wf.bean.WfMsoResponse;
@@ -111,7 +111,7 @@ public class SchedulerTestLoopbackServiceImpl implements SchedulerTestLoopbackSe
Map<String, String> nodes = new HashMap<>();
List<String> nodeList = new ArrayList<>();
// get total number of nodes across all groups.
- for (ElementInfo sr : request.getElements()) {
+ for (OptimizerElementInfo sr : request.getElements()) {
nodes.put(sr.getElementId(), sr.getGroupId());
nodeList.add(sr.getElementId());
}