# limitations under the License.\r
#-------------------------------------------------------------------------------\r
\r
+## Loopback \r
cmso.optimizer.request.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule\r
cmso.optimizer.status.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule\r
cmso.optimizer.health.url=http://localhost:8080/cmso/v1/loopbacktest/optimize/schedule/health\r
+\r
+## Local optimizer service\r
+#cmso.optimizer.request.url=http://127.0.0.1:7997/optimizer/v1/optimize/schedule\r
+#cmso.optimizer.status.url=http://127.0.0.1:7997/optimizer/v1/optimize/schedule\r
+#cmso.optimizer.health.url=http://127.0.0.1:7997/optimizer/v1/health?checkInterfaces=true\r
\r
@Controller\r
public class DispatcherServiceImpl implements DispacherService {\r
- private static EELFLogger log = EELFManager.getInstance().getLogger(DispatcherServiceImpl.class);\r
private static EELFLogger audit = EELFManager.getInstance().getAuditLogger();\r
private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();\r
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();\r
/*\r
* Copyright © 2017-2018 AT&T Intellectual Property.\r
* Modifications Copyright © 2018 IBM.\r
- * \r
+ *\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, software\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
- * \r
- * \r
+ *\r
+ *\r
* Unless otherwise specified, all documentation contained herein is licensed\r
* under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
* you may not use this documentation except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* https://creativecommons.org/licenses/by/4.0/\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, documentation\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
*/\r
@Component\r
public class CMSQueueJob {\r
- private static EELFLogger log = EELFManager.getInstance().getLogger(CMSQueueJob.class);\r
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();\r
\r
@Autowired\r
/*\r
* Copyright © 2017-2018 AT&T Intellectual Property.\r
* Modifications Copyright © 2018 IBM.\r
- * \r
+ *\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, software\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
- * \r
- * \r
+ *\r
+ *\r
* Unless otherwise specified, all documentation contained herein is licensed\r
* under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
* you may not use this documentation except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* https://creativecommons.org/licenses/by/4.0/\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, documentation\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
@Component\r
@DisallowConcurrentExecution\r
public class CmQuartzJob extends QuartzJobBean {\r
- private static EELFLogger log = EELFManager.getInstance().getLogger(CmQuartzJob.class);\r
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();\r
\r
@Autowired\r
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;
@Component
public class CmsoClientFilters implements ClientRequestFilter, ClientResponseFilter {
- private static EELFLogger log = EELFManager.getInstance().getLogger(CmsoClientFilters.class);
private static String appId = "cmso";
@Override
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;
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());
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();
--- /dev/null
+/*******************************************************************************
+ *
+ * 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 "";
+ }
+}
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<>();
}
- 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;
}
import org.onap.observations.Observation;\r
import org.onap.optf.cmso.common.LogMessages;\r
import org.onap.optf.cmso.common.PropertiesManagement;\r
+import org.onap.optf.cmso.optimizer.model.OptimizerElementInfo;\r
import org.onap.optf.cmso.optimizer.model.OptimizerRequest;\r
import org.onap.optf.cmso.optimizer.model.OptimizerResponse;\r
import org.onap.optf.cmso.optimizer.model.OptimizerScheduleInfo;\r
import org.onap.optf.cmso.optimizer.model.UnScheduledElement;\r
import org.onap.optf.cmso.service.rs.CmsoOptimizerCallbackImpl;\r
import org.onap.optf.cmso.service.rs.models.v2.ChangeWindow;\r
-import org.onap.optf.cmso.service.rs.models.v2.ElementInfo;\r
import org.onap.optf.cmso.wf.bean.WfCmResponse200;\r
import org.onap.optf.cmso.wf.bean.WfMsoRequestReferences;\r
import org.onap.optf.cmso.wf.bean.WfMsoResponse;\r
Map<String, String> nodes = new HashMap<>();\r
List<String> nodeList = new ArrayList<>();\r
// get total number of nodes across all groups.\r
- for (ElementInfo sr : request.getElements()) {\r
+ for (OptimizerElementInfo sr : request.getElements()) {\r
nodes.put(sr.getElementId(), sr.getGroupId());\r
nodeList.add(sr.getElementId());\r
}\r