aboutsummaryrefslogtreecommitdiffstats
path: root/cmso-optimizer/src
diff options
context:
space:
mode:
authorJerry Flood <jflood@att.com>2019-03-28 05:54:30 -0400
committerJerry Flood <jflood@att.com>2019-03-28 06:02:44 -0400
commit42a54948b322b6c49e42f4125728a76188d7075e (patch)
tree49700d962cbb690b672452b8e1393e9f8ce294a5 /cmso-optimizer/src
parent24fa414588a4dca98d6e215ecf486769a7e293bb (diff)
Commit 8 for Define OPtimizer API mS
Multiple commits required due to commit size limitation. Change-Id: Ie67ee24ee399aa324502456396ac7f325f051914 Issue-ID: OPTFRA-437 Signed-off-by: Jerry Flood <jflood@att.com>
Diffstat (limited to 'cmso-optimizer/src')
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/OptimizerInterfaceImpl.java172
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java84
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ConstraintElements.java127
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ElementInfo.java90
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ElementLocation.java92
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/HealthCheckComponent.java93
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/HealthCheckMessage.java109
-rw-r--r--cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/NameValue.java94
8 files changed, 861 insertions, 0 deletions
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/OptimizerInterfaceImpl.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/OptimizerInterfaceImpl.java
new file mode 100644
index 0000000..a2a018a
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/OptimizerInterfaceImpl.java
@@ -0,0 +1,172 @@
+/*
+ * 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.service.rs;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import java.util.ArrayList;
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import org.onap.observations.Observation;
+import org.onap.optf.cmso.common.exceptions.CmsoException;
+import org.onap.optf.cmso.optimizer.common.LogMessages;
+import org.onap.optf.cmso.optimizer.core.OptimizerManager;
+import org.onap.optf.cmso.optimizer.model.dao.RequestDao;
+import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerRequest;
+import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerResponse;
+import org.onap.optf.cmso.optimizer.service.rs.models.OptimizerResponse.OptimizeScheduleStatus;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+
+@Controller
+public class OptimizerInterfaceImpl implements OptimizerInterface {
+ private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
+
+ @Autowired
+ Environment env;
+
+ @Context
+ UriInfo uri;
+
+ @Context
+ HttpServletRequest httpRequest;
+
+ @Autowired
+ OptimizerManager optimizerManager;
+
+ @Autowired
+ RequestDao requestDao;
+
+ @Override
+ @Transactional
+ public Response optimizeSchedule(String apiVersion, OptimizerRequest request) {
+ String id = request.getRequestId();
+ Observation.report(LogMessages.OPTIMIZE_SCHEDULE, "Received", httpRequest.getRemoteAddr(), id, "");
+ Response response = null;
+ try {
+ optimizerManager.validate(request); // Throws CmsException if invalid message
+ OptimizerResponse optimizerResponse = optimizerManager.processOptimizerRequest(request);
+ if (optimizerResponse != null)
+ {
+ response = Response.ok(optimizerResponse).build();
+ } else {
+ // Request will be processed asynchronously
+ response = Response.accepted().build();
+ }
+ } catch (CmsoException e) {
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
+ response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
+ } catch (Exception e) {
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ response = Response.serverError().build();
+ }
+ Observation.report(LogMessages.OPTIMIZE_SCHEDULE, "Returned", httpRequest.getRemoteAddr(), id,
+ response.getStatusInfo().toString());
+ return response;
+ }
+
+
+ @Override
+ public Response getPolicies(String apiVersion) {
+ // TODO Auto-generated method stub
+ Observation.report(LogMessages.GET_POLICIES, "Received", httpRequest.getRemoteAddr(), "", "");
+ Response response = null;
+ try {
+ List<OptimizerResponse> list = new ArrayList<>();
+ response = Response.ok(list).build();
+ // } catch (CMSException e) {
+ // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ // Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
+ // response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
+ } catch (Exception e) {
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ response = Response.serverError().build();
+ }
+ Observation.report(LogMessages.GET_POLICIES, "Returned", httpRequest.getRemoteAddr(), "",
+ response.getStatusInfo().toString());
+ return response;
+ }
+
+
+ @Override
+ public Response getSchedule(String apiVersion, String id) {
+ // TODO Auto-generated method stub
+ Observation.report(LogMessages.GET_SCHEDULE, "Received", httpRequest.getRemoteAddr(), id, "");
+ Response response = null;
+ try {
+ OptimizerResponse atr = new OptimizerResponse();
+ atr.setStatus(OptimizeScheduleStatus.CREATED);
+ atr.setRequestId(id);
+ response = Response.ok(atr).build();
+ // } catch (CMSException e) {
+ // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ // Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
+ // response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
+ } catch (Exception e) {
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ response = Response.serverError().build();
+ }
+ Observation.report(LogMessages.GET_SCHEDULE, "Returned", httpRequest.getRemoteAddr(), id,
+ response.getStatusInfo().toString());
+ return response;
+ }
+
+
+ @Override
+ public Response deleteSchedule(String apiVersion, String id) {
+ // TODO Auto-generated method stub
+ Observation.report(LogMessages.DELETE_SCHEDULE, "Received", httpRequest.getRemoteAddr(), id, "");
+ Response response = null;
+ try {
+ OptimizerResponse atr = new OptimizerResponse();
+ atr.setStatus(OptimizeScheduleStatus.DELETED);
+ atr.setRequestId(id);
+ response = Response.noContent().build();
+ // } catch (CMSException e) {
+ // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ // Observation.report(LogMessages.EXPECTED_EXCEPTION, e, e.getMessage());
+ // response = Response.status(e.getStatus()).entity(e.getRequestError()).build();
+ } catch (Exception e) {
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ response = Response.serverError().build();
+ }
+ Observation.report(LogMessages.DELETE_SCHEDULE, "Returned", httpRequest.getRemoteAddr(), id,
+ response.getStatusInfo().toString());
+ return response;
+ }
+}
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
new file mode 100644
index 0000000..30104f4
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ChangeWindow.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed under the Creative
+ * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.optf.cmso.optimizer.service.rs.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.Date;
+import org.springframework.format.annotation.DateTimeFormat;
+
+@ApiModel(value = "Change Window", description = "Time window for which tickets are to returned")
+public class ChangeWindow implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(ChangeWindow.class);
+
+ @ApiModelProperty(value = "Earliest time for which changes may begin.")
+ @DateTimeFormat(pattern = "yyyy-MM-dd'T'hh:mm:ss'Z'")
+ private Date startTime;
+
+ @ApiModelProperty(value = "Latest time by which all changes must be completed.")
+ @DateTimeFormat(pattern = "yyyy-MM-dd'T'hh:mm:ss'Z'")
+ private Date endTime;
+
+ public Date getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(Date startTime) {
+ this.startTime = startTime;
+ }
+
+ public Date getEndTime() {
+ return endTime;
+ }
+
+ public void setEndTime(Date endTime) {
+ this.endTime = endTime;
+ }
+
+ /**
+ * To string.
+ *
+ * @return the string
+ */
+ @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/service/rs/models/ConstraintElements.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ConstraintElements.java
new file mode 100644
index 0000000..0cbd6e2
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ConstraintElements.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ *
+ * 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.service.rs.models;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.io.Serializable;
+import java.util.List;
+
+@ApiModel(value = "Topology Constraint Elements",
+ description = "Constraining Element Information returned from TopologyRequuest.")
+public class ConstraintElements implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public enum AvailabilityMatrixScope {
+ NONE, GLOBAL, ELEMENT,
+ }
+
+ @ApiModelProperty(value = "Element identifier")
+ private String elementId;
+
+ @ApiModelProperty(value = "Type of constraint.")
+ private String constraintType;
+
+ @ApiModelProperty(
+ value = "If more than one instance of constraintType,"
+ + " minimum number of available instances required."
+ + " Useful for identifying availableBackup elements, service paths.")
+ private Integer constraintTypeMinimum = 1;
+
+ @ApiModelProperty(value = "Availability matrix name. Availability matrix will not be passed to optimizer engine."
+ + " Generally useful for global concurrency type constraints.")
+ private String optimizerAvailabilityMatrixName;
+
+ @ApiModelProperty(value = "Availability matrix scope global or scoped per elementId.")
+ private AvailabilityMatrixScope availabilityMatrixScope = AvailabilityMatrixScope.NONE;
+
+ @ApiModelProperty(value = "Availability matrix is aggregated into element availability marrix.")
+ private boolean elementAvailabilityAggreagation = true;
+
+ @ApiModelProperty(value = "Elements ")
+ private List<String> elements;
+
+ public String getElementId() {
+ return elementId;
+ }
+
+ public void setElementId(String elementId) {
+ this.elementId = elementId;
+ }
+
+ public String getConstraintType() {
+ return constraintType;
+ }
+
+ public void setConstraintType(String constraintType) {
+ this.constraintType = constraintType;
+ }
+
+ public Integer getConstraintTypeMinimum() {
+ return constraintTypeMinimum;
+ }
+
+ public void setConstraintTypeMinimum(Integer constraintTypeMinimum) {
+ this.constraintTypeMinimum = constraintTypeMinimum;
+ }
+
+ public String getOptimizerAvailabilityMatrixName() {
+ return optimizerAvailabilityMatrixName;
+ }
+
+ public void setOptimizerAvailabilityMatrixName(String optimizerAvailabilityMatrixName) {
+ this.optimizerAvailabilityMatrixName = optimizerAvailabilityMatrixName;
+ }
+
+ public List<String> getElements() {
+ return elements;
+ }
+
+ public void setElements(List<String> elements) {
+ this.elements = elements;
+ }
+
+ public AvailabilityMatrixScope getAvailabilityMatrixScope() {
+ return availabilityMatrixScope;
+ }
+
+ public void setAvailabilityMatrixScope(AvailabilityMatrixScope availabilityMatrixScope) {
+ this.availabilityMatrixScope = availabilityMatrixScope;
+ }
+
+ public boolean isElementAvailabilityAggreagation() {
+ return elementAvailabilityAggreagation;
+ }
+
+ public void setElementAvailabilityAggreagation(boolean elementAvailabilityAggreagation) {
+ this.elementAvailabilityAggreagation = elementAvailabilityAggreagation;
+ }
+
+
+
+}
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ElementInfo.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ElementInfo.java
new file mode 100644
index 0000000..7c2e074
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ElementInfo.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ *
+ * 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.service.rs.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.List;
+
+@ApiModel(value = "Optimizer Element", description = "Element to be scheduled.")
+public class ElementInfo implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(ElementInfo.class);
+
+ @ApiModelProperty(value = "Element identifier")
+ private String elementId;
+
+ @ApiModelProperty(value = "Implementation specific element data.")
+ public List<NameValue> elementData = new ArrayList<>();
+
+ @ApiModelProperty(value = "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-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ElementLocation.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ElementLocation.java
new file mode 100644
index 0000000..0e82237
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/ElementLocation.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed under the Creative
+ * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.optf.cmso.optimizer.service.rs.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;
+
+@ApiModel(value = "Element Location", description = "Location information necessary to determine timezone."
+ + " lat/lon and/or timezone must be provided")
+public class ElementLocation implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(ElementLocation.class);
+
+ @ApiModelProperty(value = "Geographic latitude of element.")
+ private Float lat;
+
+ @ApiModelProperty(value = "Geographic longitude of element.")
+ private Float lon;
+
+ @ApiModelProperty(value = "Timezone.")
+ private String timezone;
+
+ public Float getLat() {
+ return lat;
+ }
+
+ public void setLat(Float lat) {
+ this.lat = lat;
+ }
+
+ public Float getLon() {
+ return lon;
+ }
+
+ public void setLon(Float lon) {
+ this.lon = lon;
+ }
+
+ public String getTimezone() {
+ return timezone;
+ }
+
+ public void setTimezone(String timezone) {
+ this.timezone = timezone;
+ }
+
+ /**
+ * To string.
+ *
+ * @return the string
+ */
+ @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/service/rs/models/HealthCheckComponent.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/HealthCheckComponent.java
new file mode 100644
index 0000000..2217bcf
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/HealthCheckComponent.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed under the Creative
+ * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.optf.cmso.optimizer.service.rs.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 java.io.Serializable;
+
+@ApiModel
+public class HealthCheckComponent implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(HealthCheckComponent.class);
+
+ private String name;
+ private String url;
+ private String status;
+ private Boolean healthy = false;
+
+ public Boolean getHealthy() {
+ return healthy;
+ }
+
+ public void setHealthy(Boolean healthy) {
+ this.healthy = healthy;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ /**
+ * To string.
+ *
+ * @return the string
+ */
+ @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/service/rs/models/HealthCheckMessage.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/HealthCheckMessage.java
new file mode 100644
index 0000000..307a935
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/HealthCheckMessage.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed under the Creative
+ * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.optf.cmso.optimizer.service.rs.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 java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+@ApiModel
+public class HealthCheckMessage implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(HealthCheckMessage.class);
+
+ private Boolean healthy = false;
+ private String buildInfo = "";
+ private String currentTime = "";
+ private String hostname = "";
+
+ private List<HealthCheckComponent> components = new ArrayList<HealthCheckComponent>();
+
+ public Boolean getHealthy() {
+ return healthy;
+ }
+
+ public void setHealthy(Boolean healthy) {
+ this.healthy = healthy;
+ }
+
+ public String getBuildInfo() {
+ return buildInfo;
+ }
+
+ public void setBuildInfo(String buildInfo) {
+ this.buildInfo = buildInfo;
+ }
+
+ public String getCurrentTime() {
+ return currentTime;
+ }
+
+ public void setCurrentTime(String currentTime) {
+ this.currentTime = currentTime;
+ }
+
+ public String getHostname() {
+ return hostname;
+ }
+
+ public void setHostname(String hostname) {
+ this.hostname = hostname;
+ }
+
+ public List<HealthCheckComponent> getComponents() {
+ return components;
+ }
+
+ public void setComponents(List<HealthCheckComponent> components) {
+ this.components = components;
+ }
+
+ public void addComponent(HealthCheckComponent components) {
+ this.components.add(components);
+ }
+
+ /**
+ * To string.
+ *
+ * @return the string
+ */
+ @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/service/rs/models/NameValue.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/NameValue.java
new file mode 100644
index 0000000..dcda0ef
--- /dev/null
+++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/service/rs/models/NameValue.java
@@ -0,0 +1,94 @@
+/*
+ * 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.service.rs.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;
+
+@ApiModel(value = "Name Value Data", description = "Instance of a name/value")
+public class NameValue implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static EELFLogger log = EELFManager.getInstance().getLogger(NameValue.class);
+
+ public NameValue() {
+
+ }
+
+ public NameValue(String name, Object value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ @ApiModelProperty(value = "Name.")
+ private String name;
+
+ @ApiModelProperty(value = "Value.")
+ private Object value;
+
+
+ public String getName() {
+ return name;
+ }
+
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+ public Object getValue() {
+ return value;
+ }
+
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+
+ /**
+ * To string.
+ *
+ * @return the string
+ */
+ @Override
+ public String toString() {
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ return mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+ log.debug("Error in toString()", e);
+ }
+ return "";
+ }
+
+}