From 4667e90557eb0216af7c11bc9c1a3faf487d96bb Mon Sep 17 00:00:00 2001 From: "Smokowski, Steve (ss835w)" Date: Mon, 24 Feb 2020 11:54:21 -0500 Subject: Update Nova Client to support Hypervisor endpoint Issue-ID: SO-2677 Change-Id: I44b872c6bf1a33a10cf0f5b2ad17a101289288f5 Signed-off-by: Smokowski, Steve (ss835w) Change-Id: I03364df162e2888fe85dba118948bebdf6fb9ea4 --- .../com/woorea/openstack/nova/model/CpuInfo.java | 104 ++++++++ .../woorea/openstack/nova/model/Hypervisor.java | 265 +++++++++++++++++++++ .../woorea/openstack/nova/model/Hypervisors.java | 60 +++++ .../com/woorea/openstack/nova/model/Service.java | 79 ++++++ .../com/woorea/openstack/nova/model/Topology.java | 79 ++++++ 5 files changed, 587 insertions(+) create mode 100644 nova-model/src/main/java/com/woorea/openstack/nova/model/CpuInfo.java create mode 100644 nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisor.java create mode 100644 nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisors.java create mode 100644 nova-model/src/main/java/com/woorea/openstack/nova/model/Service.java create mode 100644 nova-model/src/main/java/com/woorea/openstack/nova/model/Topology.java (limited to 'nova-model') diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/CpuInfo.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/CpuInfo.java new file mode 100644 index 0000000..bf52fb7 --- /dev/null +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/CpuInfo.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * 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========================================================= + */ + +package com.woorea.openstack.nova.model; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class CpuInfo { + + @JsonProperty("arch") + private String arch; + @JsonProperty("model") + private String model; + @JsonProperty("vendor") + private String vendor; + @JsonProperty("features") + private List features = null; + @JsonProperty("topology") + private Topology topology; + @JsonIgnore + private Map additionalProperties = new HashMap(); + + @JsonProperty("arch") + public String getArch() { + return arch; + } + + @JsonProperty("arch") + public void setArch(String arch) { + this.arch = arch; + } + + @JsonProperty("model") + public String getModel() { + return model; + } + + @JsonProperty("model") + public void setModel(String model) { + this.model = model; + } + + @JsonProperty("vendor") + public String getVendor() { + return vendor; + } + + @JsonProperty("vendor") + public void setVendor(String vendor) { + this.vendor = vendor; + } + + @JsonProperty("features") + public List getFeatures() { + return features; + } + + @JsonProperty("features") + public void setFeatures(List features) { + this.features = features; + } + + @JsonProperty("topology") + public Topology getTopology() { + return topology; + } + + @JsonProperty("topology") + public void setTopology(Topology topology) { + this.topology = topology; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisor.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisor.java new file mode 100644 index 0000000..fb5d9d2 --- /dev/null +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisor.java @@ -0,0 +1,265 @@ +/*- + * ============LICENSE_START======================================================= + * 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========================================================= + */ + +package com.woorea.openstack.nova.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Hypervisor { + + @JsonProperty("cpu_info") + private CpuInfo cpuInfo; + @JsonProperty("current_workload") + private Integer currentWorkload; + @JsonProperty("status") + private String status; + @JsonProperty("state") + private String state; + @JsonProperty("disk_available_least") + private Integer diskAvailableLeast; + @JsonProperty("host_ip") + private String hostIp; + @JsonProperty("free_disk_gb") + private Integer freeDiskGb; + @JsonProperty("free_ram_mb") + private Integer freeRamMb; + @JsonProperty("hypervisor_hostname") + private String hypervisorHostname; + @JsonProperty("hypervisor_type") + private String hypervisorType; + @JsonProperty("hypervisor_version") + private Integer hypervisorVersion; + @JsonProperty("id") + private Integer id; + @JsonProperty("local_gb") + private Integer localGb; + @JsonProperty("local_gb_used") + private Integer localGbUsed; + @JsonProperty("memory_mb") + private Integer memoryMb; + @JsonProperty("memory_mb_used") + private Integer memoryMbUsed; + @JsonProperty("running_vms") + private Integer runningVms; + @JsonProperty("service") + private Service service; + @JsonProperty("vcpus") + private Integer vcpus; + @JsonProperty("vcpus_used") + private Integer vcpusUsed; + + @JsonProperty("cpu_info") + public CpuInfo getCpuInfo() { + return cpuInfo; + } + + @JsonProperty("cpu_info") + public void setCpuInfo(CpuInfo cpuInfo) { + this.cpuInfo = cpuInfo; + } + + @JsonProperty("current_workload") + public Integer getCurrentWorkload() { + return currentWorkload; + } + + @JsonProperty("current_workload") + public void setCurrentWorkload(Integer currentWorkload) { + this.currentWorkload = currentWorkload; + } + + @JsonProperty("status") + public String getStatus() { + return status; + } + + @JsonProperty("status") + public void setStatus(String status) { + this.status = status; + } + + @JsonProperty("state") + public String getState() { + return state; + } + + @JsonProperty("state") + public void setState(String state) { + this.state = state; + } + + @JsonProperty("disk_available_least") + public Integer getDiskAvailableLeast() { + return diskAvailableLeast; + } + + @JsonProperty("disk_available_least") + public void setDiskAvailableLeast(Integer diskAvailableLeast) { + this.diskAvailableLeast = diskAvailableLeast; + } + + @JsonProperty("host_ip") + public String getHostIp() { + return hostIp; + } + + @JsonProperty("host_ip") + public void setHostIp(String hostIp) { + this.hostIp = hostIp; + } + + @JsonProperty("free_disk_gb") + public Integer getFreeDiskGb() { + return freeDiskGb; + } + + @JsonProperty("free_disk_gb") + public void setFreeDiskGb(Integer freeDiskGb) { + this.freeDiskGb = freeDiskGb; + } + + @JsonProperty("free_ram_mb") + public Integer getFreeRamMb() { + return freeRamMb; + } + + @JsonProperty("free_ram_mb") + public void setFreeRamMb(Integer freeRamMb) { + this.freeRamMb = freeRamMb; + } + + @JsonProperty("hypervisor_hostname") + public String getHypervisorHostname() { + return hypervisorHostname; + } + + @JsonProperty("hypervisor_hostname") + public void setHypervisorHostname(String hypervisorHostname) { + this.hypervisorHostname = hypervisorHostname; + } + + @JsonProperty("hypervisor_type") + public String getHypervisorType() { + return hypervisorType; + } + + @JsonProperty("hypervisor_type") + public void setHypervisorType(String hypervisorType) { + this.hypervisorType = hypervisorType; + } + + @JsonProperty("hypervisor_version") + public Integer getHypervisorVersion() { + return hypervisorVersion; + } + + @JsonProperty("hypervisor_version") + public void setHypervisorVersion(Integer hypervisorVersion) { + this.hypervisorVersion = hypervisorVersion; + } + + @JsonProperty("id") + public Integer getId() { + return id; + } + + @JsonProperty("id") + public void setId(Integer id) { + this.id = id; + } + + @JsonProperty("local_gb") + public Integer getLocalGb() { + return localGb; + } + + @JsonProperty("local_gb") + public void setLocalGb(Integer localGb) { + this.localGb = localGb; + } + + @JsonProperty("local_gb_used") + public Integer getLocalGbUsed() { + return localGbUsed; + } + + @JsonProperty("local_gb_used") + public void setLocalGbUsed(Integer localGbUsed) { + this.localGbUsed = localGbUsed; + } + + @JsonProperty("memory_mb") + public Integer getMemoryMb() { + return memoryMb; + } + + @JsonProperty("memory_mb") + public void setMemoryMb(Integer memoryMb) { + this.memoryMb = memoryMb; + } + + @JsonProperty("memory_mb_used") + public Integer getMemoryMbUsed() { + return memoryMbUsed; + } + + @JsonProperty("memory_mb_used") + public void setMemoryMbUsed(Integer memoryMbUsed) { + this.memoryMbUsed = memoryMbUsed; + } + + @JsonProperty("running_vms") + public Integer getRunningVms() { + return runningVms; + } + + @JsonProperty("running_vms") + public void setRunningVms(Integer runningVms) { + this.runningVms = runningVms; + } + + @JsonProperty("service") + public Service getService() { + return service; + } + + @JsonProperty("service") + public void setService(Service service) { + this.service = service; + } + + @JsonProperty("vcpus") + public Integer getVcpus() { + return vcpus; + } + + @JsonProperty("vcpus") + public void setVcpus(Integer vcpus) { + this.vcpus = vcpus; + } + + @JsonProperty("vcpus_used") + public Integer getVcpusUsed() { + return vcpusUsed; + } + + @JsonProperty("vcpus_used") + public void setVcpusUsed(Integer vcpusUsed) { + this.vcpusUsed = vcpusUsed; + } +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisors.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisors.java new file mode 100644 index 0000000..c75d871 --- /dev/null +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisors.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * 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========================================================= + */ + +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + + +public class Hypervisors implements Iterable, Serializable { + + /** + * + */ + private static final long serialVersionUID = 3609243147419561496L; + + @JsonProperty("hypervisors") + private List list; + + @JsonProperty("hypervisors_links") + private List links; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Hypervisor [list=" + list + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Service.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Service.java new file mode 100644 index 0000000..f1aeb14 --- /dev/null +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Service.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * 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========================================================= + */ + +package com.woorea.openstack.nova.model; + +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Service { + + @JsonProperty("host") + private String host; + @JsonProperty("id") + private Integer id; + @JsonProperty("disabled_reason") + private Object disabledReason; + @JsonIgnore + private Map additionalProperties = new HashMap(); + + @JsonProperty("host") + public String getHost() { + return host; + } + + @JsonProperty("host") + public void setHost(String host) { + this.host = host; + } + + @JsonProperty("id") + public Integer getId() { + return id; + } + + @JsonProperty("id") + public void setId(Integer id) { + this.id = id; + } + + @JsonProperty("disabled_reason") + public Object getDisabledReason() { + return disabledReason; + } + + @JsonProperty("disabled_reason") + public void setDisabledReason(Object disabledReason) { + this.disabledReason = disabledReason; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Topology.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Topology.java new file mode 100644 index 0000000..c083357 --- /dev/null +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Topology.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * 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========================================================= + */ + +package com.woorea.openstack.nova.model; + +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Topology { + + @JsonProperty("cores") + private Integer cores; + @JsonProperty("threads") + private Integer threads; + @JsonProperty("sockets") + private Integer sockets; + @JsonIgnore + private Map additionalProperties = new HashMap(); + + @JsonProperty("cores") + public Integer getCores() { + return cores; + } + + @JsonProperty("cores") + public void setCores(Integer cores) { + this.cores = cores; + } + + @JsonProperty("threads") + public Integer getThreads() { + return threads; + } + + @JsonProperty("threads") + public void setThreads(Integer threads) { + this.threads = threads; + } + + @JsonProperty("sockets") + public Integer getSockets() { + return sockets; + } + + @JsonProperty("sockets") + public void setSockets(Integer sockets) { + this.sockets = sockets; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + +} -- cgit 1.2.3-korg