From 1fc39d2497da385bbeecc2d2162dedf8be706c14 Mon Sep 17 00:00:00 2001 From: Jerry Flood Date: Tue, 26 Mar 2019 15:02:21 -0400 Subject: Commit 6 for Define Topology API mS Multiple commits required due to commit size limitation. Change-Id: Ida47ee4c6decd10fba8b59d8bb0f872433c74ba7 Issue-ID: OPTFRA-430 Signed-off-by: Jerry Flood --- .../cmso/topology/service/rs/models/NameValue.java | 94 ++++++++++++++++ .../topology/service/rs/models/PolicyInfo.java | 88 +++++++++++++++ .../service/rs/models/ReferencedElementInfo.java | 100 +++++++++++++++++ .../service/rs/models/TopologyRequest.java | 113 +++++++++++++++++++ .../service/rs/models/TopologyResponse.java | 120 +++++++++++++++++++++ 5 files changed, 515 insertions(+) create mode 100644 cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/NameValue.java create mode 100644 cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/PolicyInfo.java create mode 100644 cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/ReferencedElementInfo.java create mode 100644 cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/TopologyRequest.java create mode 100644 cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/TopologyResponse.java (limited to 'cmso-topology/src/main/java/org/onap') diff --git a/cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/NameValue.java b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/NameValue.java new file mode 100644 index 0000000..a7911d9 --- /dev/null +++ b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/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.topology.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 ""; + } + +} diff --git a/cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/PolicyInfo.java b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/PolicyInfo.java new file mode 100644 index 0000000..60dca31 --- /dev/null +++ b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/PolicyInfo.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * + * 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.topology.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 = "Supported Policy Information", description = "Policy Information returned from get policies API.") +public class PolicyInfo implements Serializable { + private static final long serialVersionUID = 1L; + private static EELFLogger log = EELFManager.getInstance().getLogger(PolicyInfo.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 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 getPolicyModifiers() { + return policyModifiers; + } + + public void setPolicyModifiers(List 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-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/ReferencedElementInfo.java b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/ReferencedElementInfo.java new file mode 100644 index 0000000..9b3d25c --- /dev/null +++ b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/ReferencedElementInfo.java @@ -0,0 +1,100 @@ +/******************************************************************************* + * + * 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.topology.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 = "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 referencingElements; + + @ApiModelProperty(value = "Implementation specific element data.") + public List 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 getRelatedElements() { + return referencingElements; + } + + public void setRelatedElements(List relatedElements) { + this.referencingElements = relatedElements; + } + + public List getElementData() { + return elementData; + } + + public void setElementData(List 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-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/TopologyRequest.java b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/TopologyRequest.java new file mode 100644 index 0000000..e58572d --- /dev/null +++ b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/TopologyRequest.java @@ -0,0 +1,113 @@ +/* + * 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.topology.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 = "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 commonData; + + @ApiModelProperty(value = "List of the elements for which topology information is requested.") + private List elements = new ArrayList<>(); + + @ApiModelProperty(value = "List of the policies to control topology retrieve.") + private List policies = new ArrayList<>(); + + public String getRequestId() { + return requestId; + } + + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + + public List getCommonData() { + return commonData; + } + + + public void setCommonData(List commonData) { + this.commonData = commonData; + } + + + public List getElements() { + return elements; + } + + + public void setElements(List elements) { + this.elements = elements; + } + + + public List getPolicies() { + return policies; + } + + + public void setPolicies(List 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 ""; + } + +} diff --git a/cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/TopologyResponse.java b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/TopologyResponse.java new file mode 100644 index 0000000..d22b64a --- /dev/null +++ b/cmso-topology/src/main/java/org/onap/optf/cmso/topology/service/rs/models/TopologyResponse.java @@ -0,0 +1,120 @@ +/* + * 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.topology.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 = "Topology Response", description = "Response to topology query for the requested elements.") +public class TopologyResponse implements Serializable { + private static final long serialVersionUID = 1L; + private static EELFLogger log = EELFManager.getInstance().getLogger(TopologyResponse.class); + + public enum TopologyRequestStatus { + IN_PROGRESS, COMPLETED, + } + + @ApiModelProperty(value = "Unique Id of the request") + private String requestId; + + @ApiModelProperty(value = "List of elements for for which topology has been requested.") + private List elements = new ArrayList<>(); + + @ApiModelProperty(value = "List of referenced elements representing the topology that has been requested.") + private List referencedElements = new ArrayList<>(); + + @ApiModelProperty(value = "Status of asynchronous request. COMPLETED is returned on initial synchonous request. " + + "If IN_PROGRESS is returned, the optimizer will enter asynchronous polling mode.") + private TopologyRequestStatus status; + + @ApiModelProperty(value = "If request is asynchronous (IN_PROGRESS), suggested interval to the next poll.") + private Integer pollingSeconds; + + public TopologyRequestStatus getStatus() { + return status; + } + + public void setStatus(TopologyRequestStatus status) { + this.status = status; + } + + public Integer getPollingSeconds() { + return pollingSeconds; + } + + public void setPollingSeconds(Integer pollingSeconds) { + this.pollingSeconds = pollingSeconds; + } + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public List getElements() { + return elements; + } + + public void setElements(List elements) { + this.elements = elements; + } + + public List getReferencedElements() { + return referencedElements; + } + + public void setReferencedElements(List referencedElements) { + this.referencedElements = referencedElements; + } + + /** + * 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 ""; + } + +} -- cgit 1.2.3-korg