Mike Kolesnik has uploaded a new change for review.

Change subject: engine: Added fields to subnet
......................................................................

engine: Added fields to subnet

Added gateway, DNS servers list, and allocation pool list to the
ExternalSubnet entity in order to allow the users to set these fields.

Change-Id: I1b3718b83bcfb588eb97a55ba559d5407b857955
Bug-Url: https://bugzilla.redhat.com/1064749
Signed-off-by: Mike Kolesnik <mkole...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/network/openstack/OpenstackNetworkProviderProxy.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/ExternalSubnet.java
2 files changed, 133 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/57/25357/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/network/openstack/OpenstackNetworkProviderProxy.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/network/openstack/OpenstackNetworkProviderProxy.java
index 5669792..b962c6a 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/network/openstack/OpenstackNetworkProviderProxy.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/network/openstack/OpenstackNetworkProviderProxy.java
@@ -146,6 +146,8 @@
                 : IpVersion.IPV4);
         s.setName(subnet.getName());
         s.setExternalNetwork(network);
+        s.setGateway(subnet.getGw());
+        s.setDnsServers(subnet.getDnsNames());
         return s;
     }
 
@@ -160,6 +162,8 @@
         subnetForCreate.setNetworkId(externalNetwork.getId());
         subnetForCreate.setTenantId(externalNetwork.getTenantId());
         subnetForCreate.setEnableDHCP(true);
+        subnetForCreate.setGw(subnet.getGateway());
+        subnetForCreate.setDnsNames(subnet.getDnsServers());
 
         try {
             getClient().subnets().create(subnetForCreate).execute();
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/ExternalSubnet.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/ExternalSubnet.java
index bbfdf0d..8d8afdc 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/ExternalSubnet.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/ExternalSubnet.java
@@ -1,6 +1,7 @@
 package org.ovirt.engine.core.common.businessentities.network;
 
 import java.io.Serializable;
+import java.util.List;
 
 import javax.validation.constraints.NotNull;
 
@@ -23,6 +24,12 @@
 
     @NotNull(groups = { RemoveEntity.class })
     private ProviderNetwork externalNetwork;
+
+    private String gateway;
+
+    private List<String> dnsServers;
+
+    private List<AllocationPool> allocationPools;
 
     public String getId() {
         return id;
@@ -70,6 +77,30 @@
         this.externalNetwork = externalNetwork;
     }
 
+    public String getGateway() {
+        return gateway;
+    }
+
+    public void setGateway(String gateway) {
+        this.gateway = gateway;
+    }
+
+    public List<String> getDnsServers() {
+        return dnsServers;
+    }
+
+    public void setDnsServers(List<String> dnsServers) {
+        this.dnsServers = dnsServers;
+    }
+
+    public List<AllocationPool> getAllocationPools() {
+        return allocationPools;
+    }
+
+    public void setAllocationPools(List<AllocationPool> allocationPools) {
+        this.allocationPools = allocationPools;
+    }
+
     @Override
     public String toString() {
         StringBuilder builder = new StringBuilder();
@@ -83,6 +114,12 @@
                 .append(getIpVersion())
                 .append(", externalNetwork=")
                 .append(getExternalNetwork())
+                .append(", gateway=")
+                .append(getGateway())
+                .append(", dnsServers=")
+                .append(getDnsServers())
+                .append(", allocationPools=")
+                .append(getAllocationPools())
                 .append("]");
         return builder.toString();
     }
@@ -96,6 +133,9 @@
         result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
         result = prime * result + ((getIpVersion() == null) ? 0 : 
getIpVersion().hashCode());
         result = prime * result + ((getName() == null) ? 0 : 
getName().hashCode());
+        result = prime * result + ((getGateway() == null) ? 0 : 
getGateway().hashCode());
+        result = prime * result + ((getDnsServers() == null) ? 0 : 
getDnsServers().hashCode());
+        result = prime * result + ((getAllocationPools() == null) ? 0 : 
getAllocationPools().hashCode());
         return result;
     }
 
@@ -142,6 +182,27 @@
         } else if (!getName().equals(other.getName())) {
             return false;
         }
+        if (getGateway() == null) {
+            if (other.getGateway() != null) {
+                return false;
+            }
+        } else if (!getGateway().equals(other.getGateway())) {
+            return false;
+        }
+        if (getDnsServers() == null) {
+            if (other.getDnsServers() != null) {
+                return false;
+            }
+        } else if (!getDnsServers().equals(other.getDnsServers())) {
+            return false;
+        }
+        if (getAllocationPools() == null) {
+            if (other.getAllocationPools() != null) {
+                return false;
+            }
+        } else if (!getAllocationPools().equals(other.getAllocationPools())) {
+            return false;
+        }
         return true;
     }
 
@@ -149,4 +210,72 @@
         IPV4,
         IPV6
     }
+
+    public static class AllocationPool {
+        private String start;
+
+        private String end;
+
+        public String getStart() {
+            return start;
+        }
+
+        public void setStart(String start) {
+            this.start = start;
+        }
+
+        public String getEnd() {
+            return end;
+        }
+
+        public void setEnd(String end) {
+            this.end = end;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder builder = new StringBuilder();
+            builder.append("AllocationPool 
[start=").append(getStart()).append(", end=").append(getEnd()).append("]");
+            return builder.toString();
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + ((getEnd() == null) ? 0 : 
getEnd().hashCode());
+            result = prime * result + ((getStart() == null) ? 0 : 
getStart().hashCode());
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (!(obj instanceof AllocationPool)) {
+                return false;
+            }
+            AllocationPool other = (AllocationPool) obj;
+            if (getEnd() == null) {
+                if (other.getEnd() != null) {
+                    return false;
+                }
+            } else if (!getEnd().equals(other.getEnd())) {
+                return false;
+            }
+            if (getStart() == null) {
+                if (other.getStart() != null) {
+                    return false;
+                }
+            } else if (!getStart().equals(other.getStart())) {
+                return false;
+            }
+            return true;
+        }
+
+    }
 }


-- 
To view, visit http://gerrit.ovirt.org/25357
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b3718b83bcfb588eb97a55ba559d5407b857955
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Mike Kolesnik <mkole...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to