Moti Asayag has uploaded a new change for review. Change subject: core: Introduce NetworkAttachment entity ......................................................................
core: Introduce NetworkAttachment entity The class is used for describing a network which is attached to a network interface. Change-Id: Ided81dc2be68dc4c7a9d491697f887cdae477a2c Signed-off-by: Moti Asayag <masa...@redhat.com> --- A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/IpConfiguration.java A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/NetworkAttachment.java M frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml 3 files changed, 239 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/11/32411/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/IpConfiguration.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/IpConfiguration.java new file mode 100644 index 0000000..247632e --- /dev/null +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/IpConfiguration.java @@ -0,0 +1,107 @@ +package org.ovirt.engine.core.common.businessentities.network; + +import java.io.Serializable; + +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; + +import org.ovirt.engine.core.common.businessentities.BusinessEntitiesDefinitions; +import org.ovirt.engine.core.common.utils.ValidationUtils; + +public class IpConfiguration implements Serializable { + private static final long serialVersionUID = -3207405803308009853L; + + private NetworkBootProtocol bootProtocol; + + @Pattern(regexp = ValidationUtils.IP_PATTERN, message = "NETWORK_ADDR_IN_STATIC_IP_BAD_FORMAT") + @Size(max = BusinessEntitiesDefinitions.GENERAL_NETWORK_ADDR_SIZE) + private String address; + + @Pattern(regexp = ValidationUtils.IP_PATTERN, message = "NETWORK_ADDR_IN_SUBNET_BAD_FORMAT") + @Size(max = BusinessEntitiesDefinitions.GENERAL_SUBNET_SIZE) + private String netmask; + + @Pattern(regexp = ValidationUtils.IP_PATTERN, message = "NETWORK_ADDR_IN_GATEWAY_BAD_FORMAT") + @Size(max = BusinessEntitiesDefinitions.GENERAL_GATEWAY_SIZE) + private String gateway; + + public NetworkBootProtocol getBootProtocol() { + return bootProtocol; + } + + public void setBootProtocol(NetworkBootProtocol bootProtocol) { + this.bootProtocol = bootProtocol; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getNetmask() { + return netmask; + } + + public void setNetmask(String netmask) { + this.netmask = netmask; + } + + public String getGateway() { + return gateway; + } + + public void setGateway(String gateway) { + this.gateway = gateway; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((address == null) ? 0 : address.hashCode()); + result = prime * result + ((bootProtocol == null) ? 0 : bootProtocol.hashCode()); + result = prime * result + ((gateway == null) ? 0 : gateway.hashCode()); + result = prime * result + ((netmask == null) ? 0 : netmask.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + IpConfiguration other = (IpConfiguration) obj; + if (address == null) { + if (other.address != null) + return false; + } else if (!address.equals(other.address)) + return false; + if (bootProtocol != other.bootProtocol) + return false; + if (gateway == null) { + if (other.gateway != null) + return false; + } else if (!gateway.equals(other.gateway)) + return false; + if (netmask == null) { + if (other.netmask != null) + return false; + } else if (!netmask.equals(other.netmask)) + return false; + return true; + } + + @Override + public String toString() { + return "IpConfiguration [bootProtocol=" + bootProtocol + + ", address=" + address + + ", netmask=" + netmask + + ", gateway=" + gateway + "]"; + } +} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/NetworkAttachment.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/NetworkAttachment.java new file mode 100644 index 0000000..3ffe705 --- /dev/null +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/NetworkAttachment.java @@ -0,0 +1,130 @@ +package org.ovirt.engine.core.common.businessentities.network; + +import java.util.Map; + +import javax.validation.constraints.NotNull; + +import org.ovirt.engine.core.common.businessentities.BusinessEntity; +import org.ovirt.engine.core.common.businessentities.IVdcQueryable; +import org.ovirt.engine.core.common.validation.group.RemoveEntity; +import org.ovirt.engine.core.common.validation.group.UpdateEntity; +import org.ovirt.engine.core.compat.Guid; + +public class NetworkAttachment extends IVdcQueryable implements BusinessEntity<Guid> { + + private static final long serialVersionUID = -8052325342869681284L; + + @NotNull(groups = { UpdateEntity.class, RemoveEntity.class }) + private Guid id; + + @NotNull + private Guid networkId; + + @NotNull + private Guid nicId; + private IpConfiguration ipConfiguration; + private Map<String, String> properties; + + public Guid getId() { + return id; + } + + public void setId(Guid id) { + this.id = id; + } + + public Guid getNetworkId() { + return networkId; + } + + public void setNetworkId(Guid networkId) { + this.networkId = networkId; + } + + public Guid getNicId() { + return nicId; + } + + public void setNicId(Guid nicId) { + this.nicId = nicId; + } + + public IpConfiguration getIpConfiguration() { + return ipConfiguration; + } + + public void setIpConfiguration(IpConfiguration ipConfiguration) { + this.ipConfiguration = ipConfiguration; + } + + public Map<String, String> getProperties() { + return properties; + } + + public void setProperties(Map<String, String> properties) { + this.properties = properties; + } + + @Override + public Object getQueryableId() { + return getId(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((ipConfiguration == null) ? 0 : ipConfiguration.hashCode()); + result = prime * result + ((networkId == null) ? 0 : networkId.hashCode()); + result = prime * result + ((nicId == null) ? 0 : nicId.hashCode()); + result = prime * result + ((properties == null) ? 0 : properties.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + NetworkAttachment other = (NetworkAttachment) obj; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + if (ipConfiguration == null) { + if (other.ipConfiguration != null) + return false; + } else if (!ipConfiguration.equals(other.ipConfiguration)) + return false; + if (networkId == null) { + if (other.networkId != null) + return false; + } else if (!networkId.equals(other.networkId)) + return false; + if (nicId == null) { + if (other.nicId != null) + return false; + } else if (!nicId.equals(other.nicId)) + return false; + if (properties == null) { + if (other.properties != null) + return false; + } else if (!properties.equals(other.properties)) + return false; + return true; + } + + @Override + public String toString() { + return "NetworkAttachment [id=" + id + + ", networkId=" + networkId + + ", nicId=" + nicId + + ", ipConfiguration=" + ipConfiguration + + ", properties=" + properties + "]"; + } +} diff --git a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml index eae76a2..024e474 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml @@ -87,6 +87,8 @@ <include name="common/businessentities/network/VnicProfile.java" /> <include name="common/businessentities/network/VmNic.java" /> <include name="common/businessentities/network/ExternalSubnet.java" /> + <include name="common/businessentities/network/IpConfiguration.java" /> + <include name="common/businessentities/network/NetworkAttachment.java" /> <include name="common/businessentities/Commented.java" /> <include name="common/businessentities/Reasoned.java" /> -- To view, visit http://gerrit.ovirt.org/32411 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ided81dc2be68dc4c7a9d491697f887cdae477a2c Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <masa...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches