diff options
Diffstat (limited to 'cmso-optimizer')
9 files changed, 901 insertions, 0 deletions
diff --git a/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/ConstraintElements.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/ConstraintElements.java new file mode 100644 index 0000000..dfd4fad --- /dev/null +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/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.clients.topology.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/clients/topology/models/ElementCriteria.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/ElementCriteria.java new file mode 100644 index 0000000..e018533 --- /dev/null +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/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.topology.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/topology/models/ElementLocation.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/ElementLocation.java new file mode 100644 index 0000000..e7f8202 --- /dev/null +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/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.clients.topology.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/clients/topology/models/HealthCheckComponent.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/HealthCheckComponent.java new file mode 100644 index 0000000..0cd9763 --- /dev/null +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/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.clients.topology.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/clients/topology/models/HealthCheckMessage.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/HealthCheckMessage.java new file mode 100644 index 0000000..c139736 --- /dev/null +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/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.clients.topology.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/clients/topology/models/ReferencedElementInfo.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/ReferencedElementInfo.java new file mode 100644 index 0000000..e51ce70 --- /dev/null +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/ReferencedElementInfo.java @@ -0,0 +1,101 @@ +/******************************************************************************* + * + * 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.topology.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; +import org.onap.optf.cmso.optimizer.service.rs.models.NameValue; + +@ApiModel(value = "Topology Related Element", description = "Element Information returned from TopologyRequuest.") +public class ReferencedElementInfo implements Serializable { + private static final long serialVersionUID = 1L; + private static EELFLogger log = EELFManager.getInstance().getLogger(ReferencedElementInfo.class); + + @ApiModelProperty(value = "Element identifier") + private String elementId; + + @ApiModelProperty(value = "Location information for the element.") + private ElementLocation elementLocation; + + @ApiModelProperty(value = "Related elements only. Element ids of the element(s) ") + private List<String> referencingElements; + + @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 ElementLocation getElementLocation() { + return elementLocation; + } + + public void setElementLocation(ElementLocation elementLocation) { + this.elementLocation = elementLocation; + } + + + public List<String> getRelatedElements() { + return referencingElements; + } + + public void setRelatedElements(List<String> relatedElements) { + this.referencingElements = relatedElements; + } + + public List<NameValue> getElementData() { + return elementData; + } + + public void setElementData(List<NameValue> elementData) { + this.elementData = elementData; + } + + @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/models/TopologyElementInfo.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/TopologyElementInfo.java new file mode 100644 index 0000000..14c96a0 --- /dev/null +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/TopologyElementInfo.java @@ -0,0 +1,113 @@ +/******************************************************************************* + * + * 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.topology.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; +import org.onap.optf.cmso.optimizer.service.rs.models.NameValue; + +@ApiModel(value = "Topology Element", description = "Element Information returned from TopologyRequuest.") +public class TopologyElementInfo implements Serializable { + private static final long serialVersionUID = 1L; + private static EELFLogger log = EELFManager.getInstance().getLogger(TopologyElementInfo.class); + + @ApiModelProperty(value = "Element identifier") + private String elementId; + + @ApiModelProperty(value = "Location information for the element.") + private ElementLocation elementLocation; + + @ApiModelProperty(value = "List of related elements required to be available to execute the chenge.") + private List<String> requiredElements; + + @ApiModelProperty(value = "Lists of related elements that must be " + + " available to avoid network outage while executing the change." + + " Each set constraint elements") + private List<ConstraintElements> constraintElements = new ArrayList<>(); + + @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 ElementLocation getElementLocation() { + return elementLocation; + } + + public void setElementLocation(ElementLocation elementLocation) { + this.elementLocation = elementLocation; + } + + public List<String> getRequiredElements() { + return requiredElements; + } + + public void setRequiredElements(List<String> requiredElements) { + this.requiredElements = requiredElements; + } + + public List<NameValue> getElementData() { + return elementData; + } + + public void setElementData(List<NameValue> elementData) { + this.elementData = elementData; + } + + public List<ConstraintElements> getConstraintElements() { + return constraintElements; + } + + public void setConstraintElements(List<ConstraintElements> constraintElements) { + this.constraintElements = constraintElements; + } + + @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/models/TopologyPolicyInfo.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/TopologyPolicyInfo.java new file mode 100644 index 0000000..9266758 --- /dev/null +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/TopologyPolicyInfo.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * + * 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.topology.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; +import org.onap.optf.cmso.optimizer.service.rs.models.NameValue; + +@ApiModel(value = "Supported Policy Information", description = "Policy Information returned from get policies API.") +public class TopologyPolicyInfo implements Serializable { + private static final long serialVersionUID = 1L; + private static EELFLogger log = EELFManager.getInstance().getLogger(TopologyPolicyInfo.class); + + @ApiModelProperty(value = "Policy name") + private String policyName; + + @ApiModelProperty(value = "Policy description") + private String policyDescription; + + @ApiModelProperty(value = "Named values to modify/override policy attributes.") + public List<NameValue> policyModifiers = new ArrayList<>(); + + public String getPolicyName() { + return policyName; + } + + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + + public String getPolicyDescription() { + return policyDescription; + } + + public void setPolicyDescription(String policyDescription) { + this.policyDescription = policyDescription; + } + + public List<NameValue> getPolicyModifiers() { + return policyModifiers; + } + + public void setPolicyModifiers(List<NameValue> policyModifiers) { + this.policyModifiers = policyModifiers; + } + + @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/models/TopologyRequest.java b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/TopologyRequest.java new file mode 100644 index 0000000..e0e95f7 --- /dev/null +++ b/cmso-optimizer/src/main/java/org/onap/optf/cmso/optimizer/clients/topology/models/TopologyRequest.java @@ -0,0 +1,114 @@ +/* + * 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.clients.topology.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; +import org.onap.optf.cmso.optimizer.service.rs.models.NameValue; + +@ApiModel(value = "Topology Request", + description = "Request to retrieve topology information for the provided elements.") +public class TopologyRequest implements Serializable { + private static final long serialVersionUID = 1L; + private static EELFLogger log = EELFManager.getInstance().getLogger(TopologyRequest.class); + + @ApiModelProperty(value = "Unique Id of the request") + private String requestId; + + @ApiModelProperty(value = "Implementation specific name value pairs.") + private List<NameValue> commonData; + + @ApiModelProperty(value = "List of the elements for which topology information is requested.") + private List<ElementCriteria> elements = new ArrayList<>(); + + @ApiModelProperty(value = "List of the policies to control topology retrieve.") + private List<TopologyPolicyInfo> policies = 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<ElementCriteria> getElements() { + return elements; + } + + + public void setElements(List<ElementCriteria> elements) { + this.elements = elements; + } + + + public List<TopologyPolicyInfo> getPolicies() { + return policies; + } + + + public void setPolicies(List<TopologyPolicyInfo> policies) { + this.policies = policies; + } + + + /** + * 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 ""; + } + +} |