[SONA] OpenstackSwitching : network() and subnet()
- Added subnet information to OpenstackNetwork class
- Added a new interface, subnet() to return the subnet information.
Change-Id: Ib46455b297909275ba36659efaee2320a111a65e
diff --git a/apps/openstackswitching/api/src/main/java/org/onosproject/openstackswitching/OpenstackNetwork.java b/apps/openstackswitching/api/src/main/java/org/onosproject/openstackswitching/OpenstackNetwork.java
index 1b28d0c..181caf8 100644
--- a/apps/openstackswitching/api/src/main/java/org/onosproject/openstackswitching/OpenstackNetwork.java
+++ b/apps/openstackswitching/api/src/main/java/org/onosproject/openstackswitching/OpenstackNetwork.java
@@ -15,6 +15,8 @@
*/
package org.onosproject.openstackswitching;
+import java.util.Collection;
+
import static com.google.common.base.Preconditions.checkNotNull;
@@ -28,6 +30,7 @@
private String segmentId;
private String id;
private NetworkType networkType;
+ private Collection<OpenstackSubnet> subnets;
public enum NetworkType {
/**
@@ -49,12 +52,13 @@
}
private OpenstackNetwork(String name, String tenantId, String id, String sid,
- NetworkType type) {
+ NetworkType type, Collection<OpenstackSubnet> subnets) {
this.name = checkNotNull(name);
this.tenantId = checkNotNull(tenantId);
this.segmentId = checkNotNull(sid);
this.id = checkNotNull(id);
this.networkType = type;
+ this.subnets = subnets;
}
public String name() {
@@ -77,6 +81,10 @@
return this.networkType;
}
+ public Collection<OpenstackSubnet> subnets() {
+ return this.subnets;
+ }
+
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
@@ -88,6 +96,7 @@
private String id;
private String sid;
private NetworkType networkType;
+ private Collection<OpenstackSubnet> subnets;
public Builder name(String name) {
this.name = name;
@@ -119,9 +128,14 @@
return this;
}
- public OpenstackNetwork build() {
- return new OpenstackNetwork(name, tenantId, id, sid, networkType);
+ public Builder subnets(Collection<OpenstackSubnet> subnets) {
+ this.subnets = subnets;
+
+ return this;
}
+ public OpenstackNetwork build() {
+ return new OpenstackNetwork(name, tenantId, id, sid, networkType, subnets);
+ }
}
}