From 2e984294ac28c6f2ede290c38164c5d536ccaf4a Mon Sep 17 00:00:00 2001 From: ChrisC Date: Tue, 31 Jan 2017 13:57:24 +0100 Subject: Initial OpenECOMP MSO OpenStack SDK lib commit Change-Id: Ieaacb2b2c0dcc469669880e73f0cda9fa59a6c5a Signed-off-by: ChrisC --- .../openstack/quantum/model/GatewayInfo.java | 24 ++ .../woorea/openstack/quantum/model/HostRoute.java | 27 ++ .../woorea/openstack/quantum/model/Network.java | 321 ++++++++++++++++++ .../openstack/quantum/model/NetworkForCreate.java | 9 + .../woorea/openstack/quantum/model/Networks.java | 38 +++ .../openstack/quantum/model/NeutronError.java | 69 ++++ .../com/woorea/openstack/quantum/model/Pool.java | 40 +++ .../com/woorea/openstack/quantum/model/Port.java | 373 +++++++++++++++++++++ .../openstack/quantum/model/PortForCreate.java | 12 + .../com/woorea/openstack/quantum/model/Ports.java | 40 +++ .../com/woorea/openstack/quantum/model/Router.java | 77 +++++ .../quantum/model/RouterForAddInterface.java | 28 ++ .../openstack/quantum/model/RouterForCreate.java | 75 +++++ .../openstack/quantum/model/RouterInterface.java | 19 ++ .../woorea/openstack/quantum/model/Routers.java | 38 +++ .../woorea/openstack/quantum/model/Segment.java | 79 +++++ .../com/woorea/openstack/quantum/model/Subnet.java | 264 +++++++++++++++ .../openstack/quantum/model/SubnetForCreate.java | 34 ++ .../woorea/openstack/quantum/model/Subnets.java | 36 ++ 19 files changed, 1603 insertions(+) create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/NetworkForCreate.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/PortForCreate.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/Segment.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java create mode 100644 quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java (limited to 'quantum-model/src/main/java/com/woorea') diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java new file mode 100644 index 0000000..2a7766f --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java @@ -0,0 +1,24 @@ +package com.woorea.openstack.quantum.model; + +import java.util.List; +import java.io.Serializable; + +import org.codehaus.jackson.annotate.JsonProperty; + +public class GatewayInfo implements Serializable { + + @JsonProperty("network_id") + private String networkId; + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String id) { + this.networkId = id; + } + + @Override public String toString() { + return "[networkId=" + networkId + "]"; + } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java new file mode 100644 index 0000000..979add3 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java @@ -0,0 +1,27 @@ +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; + +public class HostRoute implements Serializable { + + private String destination; + private String nexthop; + + public String getDestination() { + return destination; + } + public void setDestination(String destination) { + this.destination = destination; + } + + public String getNexthop() { + return nexthop; + } + public void setNexthop(String nexthop) { + this.nexthop = nexthop; + } + + @Override public String toString() { + return "[destination=" + destination + ", nexthop=" + nexthop + "]"; + } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java new file mode 100644 index 0000000..f880619 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java @@ -0,0 +1,321 @@ +package com.woorea.openstack.quantum.model; + +/* + * Modifications copyright (c) 2017 AT&T Intellectual Property + */ + +import java.io.Serializable; +import java.util.List; + +import org.codehaus.jackson.annotate.JsonIgnore; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonRootName; + +/** + * Network Extension supporting both Provider networks and Multi-Provider networks. + * The attributes for both of these network extensions are included. + * It is the responsibility of users to populate only one or the other. It is + * also critical that the Mapper is set for serialization inclusion.NON_NULL, or + * both would be sent to Openstack which would cause an error. + * + */ +@SuppressWarnings("serial") +@JsonRootName("network") +@JsonIgnoreProperties(ignoreUnknown = true) +public class Network implements Serializable { + + private String status; + + private List subnets; + + private String name; + + @JsonProperty("admin_state_up") + private Boolean adminStateUp; + + @JsonProperty("tenant_id") + private String tenantId; + + @JsonProperty("provider:physical_network") + private String providerPhysicalNetwork; + + @JsonProperty("provider:network_type") + private String providerNetworkType; + + @JsonProperty("provider:segmentation_id") + private Integer providerSegmentationId; + + @JsonProperty("router:external") + private String routerExternal; + + private String id; + + private String shared; + + private List segments; + + /** + * @return the status + */ + @JsonIgnore + public String getStatus() { + return status; + } + + /** + * @param status + * the status to set + */ + @JsonProperty + public void setStatus(String status) { + this.status = status; + } + + /** + * @return the subnets + */ + @JsonIgnore + public List getSubnets() { + return subnets; + } + + /** + * @param subnets + * the subnets to set + */ + @JsonProperty + public void setSubnets(List subnets) { + this.subnets = subnets; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the providerPhyNet + * @deprecated + */ + @Deprecated + @JsonIgnore + public String getProviderPhyNet() { + return getProviderPhysicalNetwork(); + } + + /** + * @param providerPhyNet + * the providerPhyNet to set + * @deprecated + */ + @Deprecated + @JsonIgnore + public void setProviderPhyNet(String providerPhyNet) { + setProviderPhysicalNetwork(providerPhyNet); + } + + /** + * @return the adminStateUp + */ + @JsonIgnore + public boolean isAdminStateUp() { + return adminStateUp; + } + + public Boolean getAdminStateUp() { + return adminStateUp; + } + + /** + * @param adminStateUp + * the adminStateUp to set + */ + public void setAdminStateUp(Boolean adminStateUp) { + this.adminStateUp = adminStateUp; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @param tenantId + * the tenantId to set + */ + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * @return the netType + * @deprecated + */ + @Deprecated + @JsonIgnore + public String getNetType() { + return getProviderNetworkType(); + } + + /** + * @param netType + * the netType to set + * @deprecated + */ + @Deprecated + @JsonIgnore + public void setNetType(String netType) { + setProviderNetworkType(netType); + } + + /** + * @return the routerExternal + */ + public String getRouterExternal() { + return routerExternal; + } + + /** + * @param routerExternal + * the routerExternal to set + */ + public void setRouterExternal(String routerExternal) { + this.routerExternal = routerExternal; + } + + /** + * @return the id + */ + @JsonIgnore + public String getId() { + return id; + } + + /** + * @param id + * the id to set + */ + @JsonProperty + public void setId(String id) { + this.id = id; + } + + /** + * @return the shared + */ + public String getShared() { + return shared; + } + + /** + * @param shared + * the shared to set + */ + public void setShared(String shared) { + this.shared = shared; + } + + /** + * @return the providerSegID + * @deprecated + */ + @Deprecated + @JsonIgnore + public String getProviderSegID() { + return getProviderSegmentationId() == null ? null : Integer.toString(getProviderSegmentationId()); + } + + /** + * @param providerSegID + * the providerSegID to set + * @deprecated + */ + @Deprecated + @JsonIgnore + public void setProviderSegID(String providerSegID) { + setProviderSegmentationId(providerSegID == null ? null : Integer.parseInt(providerSegID)); + } + + public String getProviderNetworkType() { + return providerNetworkType; + } + + public void setProviderNetworkType(String providerNetworkType) { + this.providerNetworkType = providerNetworkType; + } + + public String getProviderPhysicalNetwork() { + return providerPhysicalNetwork; + } + + public void setProviderPhysicalNetwork(String providerPhysicalNetwork) { + this.providerPhysicalNetwork = providerPhysicalNetwork; + } + + public Integer getProviderSegmentationId() { + return providerSegmentationId; + } + + public void setProviderSegmentationId(Integer providerSegmentationId) { + this.providerSegmentationId = providerSegmentationId; + } + + public List getSegments() { + return segments; + } + + public void setSegments(List segments) { + this.segments = segments; + } + + /** + * Function to detect and return the network type + */ + public enum NetworkType { BASIC, PROVIDER, MULTI_PROVIDER }; + + @JsonIgnore + public NetworkType getNetworkType () { + if (segments != null) + return NetworkType.MULTI_PROVIDER; + else if (providerNetworkType != null) + return NetworkType.PROVIDER; + else + return NetworkType.BASIC; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuffer buf = new StringBuffer("Network [id=" + id + ", name=" + name + ", subnets=" + + subnets + ", status=" + status + ", admin_state_up=" + adminStateUp + ", tenant_id=" + + tenantId + ", shared=" + shared + ", router:external=" + routerExternal); + if (getNetworkType() == NetworkType.PROVIDER) + buf.append (", provider:physical_network=" + providerPhysicalNetwork + + ", provider:network_type=" + providerNetworkType + + ", provider:segmentation_id=" + providerSegmentationId); + if (getNetworkType() == NetworkType.MULTI_PROVIDER) { + buf.append (", segments: "); + for (Segment s : segments) + buf.append (s.toString()).append(" "); + } + buf.append ("]"); + return buf.toString(); + } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NetworkForCreate.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NetworkForCreate.java new file mode 100644 index 0000000..507e39b --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NetworkForCreate.java @@ -0,0 +1,9 @@ +package com.woorea.openstack.quantum.model; + +import org.codehaus.jackson.map.annotate.JsonRootName; + +@SuppressWarnings("serial") +@JsonRootName("network") +@Deprecated +public class NetworkForCreate extends Network { +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java new file mode 100644 index 0000000..a4fd330 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java @@ -0,0 +1,38 @@ +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; +import org.codehaus.jackson.annotate.JsonProperty; + +public class Networks implements Iterable, Serializable{ + + @JsonProperty("networks") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + + /** + * @param list the list to set + */ + public void setList(List list) { + this.list = list; + } + + + public String toString() { + return "Networks [list=" + list + "]"; + } + + + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java new file mode 100644 index 0000000..3fbd390 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java @@ -0,0 +1,69 @@ +/* + * ============LICENSE_START========================================== + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * 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. + * ============LICENSE_END============================================ + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + * + */ + +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; + +import org.codehaus.jackson.map.annotate.JsonRootName; + +@JsonRootName("NeutronError") +public class NeutronError implements Serializable { + + private String type; + + private String message; + + private String detail; + + /** + * @return the code + */ + public String getType() { + return type; + } + + /** + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * @return the title + */ + public String getDetail() { + return detail; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "NeutronError [type=" + type + ", title=" + detail + ", message=" + + message + "]"; + } + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java new file mode 100644 index 0000000..d25bafe --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java @@ -0,0 +1,40 @@ +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; + +public class Pool implements Serializable{ + + private String start; + private String end; + + /** + * @return the start + */ + public String getStart() { + return start; + } + /** + * @param start the start to set + */ + public void setStart(String start) { + this.start = start; + } + /** + * @return the end + */ + public String getEnd() { + return end; + } + /** + * @param end the end to set + */ + public void setEnd(String end) { + this.end = end; + } + + @Override + public String toString() { + return "Allocation_pool [start=" + start + ", end=" + end + "]"; + } + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java new file mode 100644 index 0000000..8ca74f1 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java @@ -0,0 +1,373 @@ +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import org.codehaus.jackson.annotate.JsonIgnore; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.annotate.JsonUnwrapped; +import org.codehaus.jackson.map.annotate.JsonRootName; + +@SuppressWarnings("serial") +@JsonRootName("port") +@JsonIgnoreProperties(ignoreUnknown = true) +public class Port implements Serializable { + + public static final class Ip implements Serializable { + + @JsonProperty("ip_address") + private String address; + + @JsonProperty("subnet_id") + private String subnetId; + + /** + * @return the address + */ + public String getAddress() { + return address; + } + + /** + * @param address + * the address to set + */ + public void setAddress(String address) { + this.address = address; + } + + /** + * @return the subnetId + */ + public String getSubnetId() { + return subnetId; + } + + /** + * @param subnetId + * the subnetId to set + */ + public void setSubnetId(String subnetId) { + this.subnetId = subnetId; + } + + @Override + public String toString() { + return "ip_addresses [ip_address=" + address + ", subnet_id=" + subnetId + "]"; + } + + } + + public static final class Binding { + + /** + * The host on which the port will be allocated. + */ + @JsonProperty("binding:host_id") + private String hostId; + + /** + * The vif type for the specific port. + */ + @JsonProperty("binding:vif_type") + private String vifType; + + /** + * The type of vnic that this port should be attached to + */ + @JsonProperty("binding:vnic_type") + private String vnicType; + + /** + * A map containing additional information needed by the interface driver + */ + @JsonProperty("binding:vif_details") + private Map vifDetails; + + /** + * A map to enable applications running on the specific host to pass and receive vif port specific information + * to the plugin. + */ + @JsonProperty("binding:profile") + private Map profile; + + public String getHostId() { + return hostId; + } + + public void setHostId(String hostId) { + this.hostId = hostId; + } + + public String getVifType() { + return vifType; + } + + public void setVifType(String vifType) { + this.vifType = vifType; + } + + public String getVnicType() { + return vnicType; + } + + public void setVnicType(String vnicType) { + this.vnicType = vnicType; + } + + public Map getVifDetails() { + return vifDetails; + } + + public void setVifDetails(Map vifDetails) { + this.vifDetails = vifDetails; + } + + public Map getProfile() { + return profile; + } + + public void setProfile(Map profile) { + this.profile = profile; + } + + @Override + public String toString() { + return "Binding [hostId=" + hostId + + ", vifType=" + vifType + + ", vnicType=" + vnicType + + ", vifDetails=" + vifDetails + + ", profile=" + profile + "]"; + } + } + + @JsonProperty("admin_state_up") + private Boolean adminStateUp; + + @JsonProperty("device_id") + private String deviceId; + + @JsonProperty("device_owner") + private String deviceOwner; + + @JsonProperty("fixed_ips") + private List list; + + private String id; + + @JsonProperty("mac_address") + private String macAddress; + + private String name; + + @JsonProperty("network_id") + private String networkId; + + private String status; + + @JsonProperty("tenant_id") + private String tenantId; + + @JsonProperty("security_groups") + private List securityGroups; + + @JsonUnwrapped + private Binding binding; + + /** + * @return the adminStateUp + */ + public Boolean getAdminStateUp() { + return adminStateUp; + } + + /** + * @param adminStateUp + * the adminStateUp to set + */ + public void setAdminStateUp(Boolean adminStateUp) { + this.adminStateUp = adminStateUp; + } + + /** + * @return the deviceId + */ + public String getDeviceId() { + return deviceId; + } + + /** + * @param deviceId + * the deviceId to set + */ + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + /** + * @return the deviceOwner + */ + public String getDeviceOwner() { + return deviceOwner; + } + + /** + * @param deviceOwner + * the deviceOwner to set + */ + public void setDeviceOwner(String deviceOwner) { + this.deviceOwner = deviceOwner; + } + + /** + * @return the list + */ + public List getList() { + return list; + } + + /** + * @param list + * the list to set + */ + public void setList(List list) { + this.list = list; + } + + /** + * @return the id + */ + @JsonIgnore + public String getId() { + return id; + } + + /** + * @param id + * the id to set + */ + @JsonProperty + public void setId(String id) { + this.id = id; + } + + /** + * @return the macAddress + */ + public String getMacAddress() { + return macAddress; + } + + /** + * @param macAddress + * the macAddress to set + */ + public void setMacAddress(String macAddress) { + this.macAddress = macAddress; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the networkId + */ + public String getNetworkId() { + return networkId; + } + + /** + * @param networkId + * the networkId to set + */ + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + /** + * @return the status + */ + @JsonIgnore + public String getStatus() { + return status; + } + + /** + * @param status + * the status to set + */ + @JsonProperty + public void setStatus(String status) { + this.status = status; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @param tenantId + * the tenantId to set + */ + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * @return the associated security group IDs + */ + public List getSecurityGroups() { + return securityGroups; + } + + /** + * @param securityGroups + * IDs of security groups to associate to the port + */ + public void setSecurityGroups(List securityGroups) { + this.securityGroups = securityGroups; + } + + /** + * @return the binding of the port + */ + public Binding getBinding() { + return binding; + } + + /** + * @param binding + * The port bindings by which the port is bind to network on host + */ + public void setBinding(Binding binding) { + this.binding = binding; + } + + @Override + public String toString() { + return "Port [id=" + id + ", name=" + name + ", mac_address=" + + macAddress + ", admin_state_up=" + adminStateUp + ", device_id=" + deviceId + + ", device_owner=" + deviceOwner + ", fixed_ips=" + list + + ", network_id=" + networkId + ", status=" + status + + ", tenant_id=" + tenantId + + ", securityGroups=" + securityGroups + + ", binding=" + binding + "]"; + } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/PortForCreate.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/PortForCreate.java new file mode 100644 index 0000000..3c1af50 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/PortForCreate.java @@ -0,0 +1,12 @@ +package com.woorea.openstack.quantum.model; + +import org.codehaus.jackson.map.annotate.JsonRootName; + +/** + * @deprecated Please use {@link Port} directly. + */ +@SuppressWarnings("serial") +@JsonRootName("port") +@Deprecated +public class PortForCreate extends Port { +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java new file mode 100644 index 0000000..5f10d35 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java @@ -0,0 +1,40 @@ +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import org.codehaus.jackson.annotate.JsonProperty; + +@SuppressWarnings("serial") +public class Ports implements Iterable, Serializable { + + @JsonProperty("ports") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /** + * @param list + * the list to set + */ + public void setList(List list) { + this.list = list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + @Override + public String toString() { + return "Ports [list=" + list + "]"; + } + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java new file mode 100644 index 0000000..a94afd5 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java @@ -0,0 +1,77 @@ +package com.woorea.openstack.quantum.model; + +import java.util.List; +import java.io.Serializable; + +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonRootName; + +@JsonRootName("router") +public class Router implements Serializable { + + @JsonProperty("status") + private String status; + + @JsonProperty("external_gateway_info") + private GatewayInfo externalGatewayInfo; + + @JsonProperty("name") + private String name; + + @JsonProperty("admin_state_up") + private String admin_state_up; + + @JsonProperty("tenant_id") + private String tenantId; + + @JsonProperty("id") + private String id; + + @JsonProperty("routes") + private List routes; + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public List getRoutes() { + return routes; + } + public void setRoutes(List routes) { + this.routes = routes; + } + public String getAdmin_state_up() { + return admin_state_up; + } + public void setAdmin_state_up(String admin_state_up) { + this.admin_state_up = admin_state_up; + } + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + public GatewayInfo getExternalGatewayInfo() { + return externalGatewayInfo; + } + public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) { + this.externalGatewayInfo = externalGatewayInfo; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java new file mode 100644 index 0000000..62ec302 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java @@ -0,0 +1,28 @@ +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; + +import org.codehaus.jackson.annotate.JsonProperty; + +public class RouterForAddInterface implements Serializable { + + @JsonProperty("subnet_id") + String subnetId; + String routerId; + + public String getSubnetId() { + return subnetId; + } + + public void setSubnetId(String subnetId) { + this.subnetId = subnetId; + } + + public String getRouterId() { + return routerId; + } + + public void setRouterId(String routerId) { + this.routerId = routerId; + } + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java new file mode 100644 index 0000000..b8c9291 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java @@ -0,0 +1,75 @@ +package com.woorea.openstack.quantum.model; + +import java.util.List; +import java.io.Serializable; + +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonRootName; + +@JsonRootName("router") +public class RouterForCreate implements Serializable { + + @JsonProperty("name") + private String name; + + private List routes; + + @JsonProperty("admin_state_up") + private String admin_state_up; + + @JsonProperty("status") + private String status; + + @JsonProperty("external_gateway_info") + private GatewayInfo externalGatewayInfo; + + @JsonProperty("tenant_id") + private String tenantId; + + @JsonProperty("id") + private String id; + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public List getRoutes() { + return routes; + } + public void setRoutes(List routes) { + this.routes = routes; + } + public String getAdmin_state_up() { + return admin_state_up; + } + public void setAdmin_state_up(String admin_state_up) { + this.admin_state_up = admin_state_up; + } + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + public GatewayInfo getExternalGatewayInfo() { + return externalGatewayInfo; + } + public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) { + this.externalGatewayInfo = externalGatewayInfo; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java new file mode 100644 index 0000000..2d7551f --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java @@ -0,0 +1,19 @@ +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; + +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonRootName; + +public class RouterInterface implements Serializable { + + @JsonProperty("subnet_id") + String subnetId; + @JsonProperty("port_id") + String portId; + @JsonProperty("tenant_id") + String tenantId; + @JsonProperty("id") + String id; + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java new file mode 100644 index 0000000..e2a56b2 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java @@ -0,0 +1,38 @@ +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; +import org.codehaus.jackson.annotate.JsonProperty; + +public class Routers implements Iterable, Serializable{ + + @JsonProperty("routers") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + + /** + * @param list the list to set + */ + public void setList(List list) { + this.list = list; + } + + + public String toString() { + return "Routers [list=" + list + "]"; + } + + + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Segment.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Segment.java new file mode 100644 index 0000000..de78967 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Segment.java @@ -0,0 +1,79 @@ +/* + * ============LICENSE_START========================================== + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * 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. + * ============LICENSE_END============================================ + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + * + */ + +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; + +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.annotate.JsonProperty; + +@SuppressWarnings("serial") +@JsonIgnoreProperties(ignoreUnknown = true) +public class Segment implements Serializable { + + @JsonProperty("provider:physical_network") + private String providerPhysicalNetwork; + + @JsonProperty("provider:network_type") + private String providerNetworkType; + + @JsonProperty("provider:segmentation_id") + private Integer providerSegmentationId; + + public String getProviderNetworkType() { + return providerNetworkType; + } + + public void setProviderNetworkType(String providerNetworkType) { + this.providerNetworkType = providerNetworkType; + } + + public String getProviderPhysicalNetwork() { + return providerPhysicalNetwork; + } + + public void setProviderPhysicalNetwork(String providerPhysicalNetwork) { + this.providerPhysicalNetwork = providerPhysicalNetwork; + } + + public Integer getProviderSegmentationId() { + return providerSegmentationId; + } + + public void setProviderSegmentationId(Integer providerSegmentationId) { + this.providerSegmentationId = providerSegmentationId; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Segment [ provider:physical_network=" + providerPhysicalNetwork + + ", provider:network_type=" + providerNetworkType + + ", provider:segmentation_id=" + providerSegmentationId + "]"; + } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java new file mode 100644 index 0000000..7301514 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java @@ -0,0 +1,264 @@ +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.List; + +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonIgnore; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.annotate.JsonValue; +import org.codehaus.jackson.map.annotate.JsonRootName; + +@SuppressWarnings("serial") +@JsonRootName("subnet") +@JsonIgnoreProperties(ignoreUnknown = true) +public class Subnet implements Serializable { + + private String name; + + @JsonProperty("enable_dhcp") + private Boolean enableDHCP; + + @JsonProperty("network_id") + private String networkId; + + @JsonProperty("tenant_id") + private String tenantId; + + @JsonProperty("dns_nameservers") + private List dnsNames; + + @JsonProperty("allocation_pools") + private List list; + + @JsonProperty("host_routes") + private List hostRoutes; + + @JsonProperty("ip_version") + private IpVersion ipversion; + + @JsonProperty("gateway_ip") + private String gw; + + private String cidr; + + private String id; + + public static enum IpVersion implements Serializable { + IPV4(4), + IPV6(6); + private int code; + + IpVersion(int code) { + this.code = code; + } + + @JsonValue + public int code() { + return code; + } + + @JsonCreator + public static IpVersion valueOf(int value) { + for (IpVersion ipVersion : IpVersion.values()) { + if (ipVersion.code() == value) { + return ipVersion; + } + } + return IPV4; + } + + @Override + public String toString() { + return String.valueOf(code); + } + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the enableDHCP + */ + @JsonIgnore + public boolean isEnableDHCP() { + return enableDHCP; + } + + public Boolean getEnableDHCP() { + return enableDHCP; + } + + /** + * @param enableDHCP + * the enableDHCP to set + */ + public void setEnableDHCP(Boolean enableDHCP) { + this.enableDHCP = enableDHCP; + } + + /** + * @return the networkId + */ + public String getNetworkId() { + return networkId; + } + + /** + * @param networkId + * the networkId to set + */ + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @param tenantId + * the tenantId to set + */ + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * @return the dnsNames + */ + public List getDnsNames() { + return dnsNames; + } + + /** + * @param dnsNames + * the dnsNames to set + */ + public void setDnsNames(List dnsNames) { + this.dnsNames = dnsNames; + } + + /** + * @return the list + */ + public List getList() { + return list; + } + + /** + * @param list + * the list to set + */ + public void setList(List list) { + this.list = list; + } + + /** + * @return the hostRoutes + */ + public List getHostRoutes() { + return hostRoutes; + } + + /** + * @param hostRoutes + * the hostRoutes to set + */ + public void setHostRoutes(List hostRoutes) { + this.hostRoutes = hostRoutes; + } + + /** + * @return the ipversion + */ + public IpVersion getIpversion() { + return ipversion; + } + + /** + * @param ipversion + * the ipversion to set + */ + public void setIpversion(IpVersion ipversion) { + this.ipversion = ipversion; + } + + /** + * @return the gw + */ + public String getGw() { + return gw; + } + + /** + * @param gw + * the gw to set + */ + public void setGw(String gw) { + this.gw = gw; + } + + /** + * @return the cidr + */ + public String getCidr() { + return cidr; + } + + /** + * @param cidr + * the cidr to set + */ + public void setCidr(String cidr) { + this.cidr = cidr; + } + + /** + * @return the id + */ + @JsonIgnore + public String getId() { + return id; + } + + /** + * @param id + * the id to set + */ + @JsonProperty + public void setId(String id) { + this.id = id; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Subnet [id=" + id + ", name=" + name + ", network_id=" + + networkId + ", tenant_id=" + tenantId + ", allocation_pools=" + list + + ", gateway_ip=" + gw + ", ip_version=" + ipversion + + ", cidr=" + cidr + ", enable_dhcp=" + enableDHCP + ", dns_nameservers=" + + dnsNames + ", host_routes=" + hostRoutes + "]"; + } + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java new file mode 100644 index 0000000..2c07ab2 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java @@ -0,0 +1,34 @@ +package com.woorea.openstack.quantum.model; + +import org.codehaus.jackson.annotate.JsonIgnore; +import org.codehaus.jackson.map.annotate.JsonRootName; + +/** + * Please use {@link Subnet} directly. + */ +@SuppressWarnings("serial") +@JsonRootName("subnet") +@Deprecated +public class SubnetForCreate extends Subnet { + + /** + * @return the ipVersion + * @deprecated + */ + @Deprecated + @JsonIgnore + public int getIpVersion() { + return getIpversion().code(); + } + + /** + * @param ipVersion + * the ipVersion to set + * @deprecated + */ + @Deprecated + @JsonIgnore + public void setIpVersion(int ipVersion) { + setIpversion(IpVersion.valueOf(ipVersion)); + } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java new file mode 100644 index 0000000..e9b21f4 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java @@ -0,0 +1,36 @@ +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import org.codehaus.jackson.annotate.JsonProperty; + +public class Subnets implements Serializable, Iterable { + + @JsonProperty("subnets") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /** + * @param list the list to set + */ + public void setList(List list) { + this.list = list; + } + + public String toString() { + return "Subnets [list=" + list + "]"; + } + + public Iterator iterator() { + return list.iterator(); + } + +} -- cgit 1.2.3-korg