ONOS-2843 Fix bug post NBI subnet get an error.

Change-Id: I93b52a0c69a57b458b610afbb78cfdec0b50e3a5
diff --git a/apps/vtnweb/src/main/java/org/onosproject/vtnweb/resources/SubnetWebResource.java b/apps/vtnweb/src/main/java/org/onosproject/vtnweb/resources/SubnetWebResource.java
index 7494f02..c46af6e 100644
--- a/apps/vtnweb/src/main/java/org/onosproject/vtnweb/resources/SubnetWebResource.java
+++ b/apps/vtnweb/src/main/java/org/onosproject/vtnweb/resources/SubnetWebResource.java
@@ -63,6 +63,7 @@
 import com.fasterxml.jackson.databind.ObjectMapper;

 import com.fasterxml.jackson.databind.node.ObjectNode;

 import com.google.common.collect.Maps;

+import com.google.common.collect.Sets;

 

 @Path("subnets")

 public class SubnetWebResource extends AbstractWebResource {

@@ -211,8 +212,8 @@
             Subnet subnet = new DefaultSubnet(id, subnetName, networkId,

                                               tenantId, ipVersion, cidr,

                                               gatewayIp, dhcpEnabled, shared,

-                                              hostRoutesIt, ipV6AddressMode,

-                                              ipV6RaMode, allocationPoolsIt);

+                                              Sets.newHashSet(hostRoutesIt), ipV6AddressMode,

+                                              ipV6RaMode, Sets.newHashSet(allocationPoolsIt));

             subMap.put(id, subnet);

         }

         return Collections.unmodifiableCollection(subMap.values());

@@ -267,9 +268,9 @@
 

         Subnet subnet = new DefaultSubnet(id, subnetName, networkId, tenantId,

                                           ipVersion, cidr, gatewayIp,

-                                          dhcpEnabled, shared, hostRoutesIt,

+                                          dhcpEnabled, shared, Sets.newHashSet(hostRoutesIt),

                                           ipV6AddressMode, ipV6RaMode,

-                                          allocationPoolsIt);

+                                          Sets.newHashSet(allocationPoolsIt));

         subMap.put(id, subnet);

         return Collections.unmodifiableCollection(subMap.values());

     }

diff --git a/apps/vtnweb/src/main/java/org/onosproject/vtnweb/resources/VirtualPortWebResource.java b/apps/vtnweb/src/main/java/org/onosproject/vtnweb/resources/VirtualPortWebResource.java
index 28f0c42..0a427bb 100644
--- a/apps/vtnweb/src/main/java/org/onosproject/vtnweb/resources/VirtualPortWebResource.java
+++ b/apps/vtnweb/src/main/java/org/onosproject/vtnweb/resources/VirtualPortWebResource.java
@@ -54,8 +54,8 @@
 import org.onosproject.vtnrsc.TenantId;

 import org.onosproject.vtnrsc.TenantNetworkId;

 import org.onosproject.vtnrsc.VirtualPort;

-import org.onosproject.vtnrsc.VirtualPortId;

 import org.onosproject.vtnrsc.VirtualPort.State;

+import org.onosproject.vtnrsc.VirtualPortId;

 import org.onosproject.vtnrsc.virtualport.VirtualPortService;

 import org.onosproject.vtnrsc.web.VirtualPortCodec;

 import org.slf4j.Logger;

@@ -65,6 +65,7 @@
 import com.fasterxml.jackson.databind.ObjectMapper;

 import com.fasterxml.jackson.databind.node.ObjectNode;

 import com.google.common.collect.Maps;

+import com.google.common.collect.Sets;

 

 /**

  * REST resource for interacting with the inventory of infrastructure

@@ -249,8 +250,8 @@
                                                        macAddress, tenantId,

                                                        deviceId, fixedIps,

                                                        bindingHostId,

-                                                       allowedAddressPairs,

-                                                       securityGroups);

+                                                       Sets.newHashSet(allowedAddressPairs),

+                                                       Sets.newHashSet(securityGroups));

             portMap.put(id, vPort);

         }

         return Collections.unmodifiableCollection(portMap.values());

@@ -308,8 +309,8 @@
                                                    macAddress, tenantId,

                                                    deviceId, fixedIps,

                                                    bindingHostId,

-                                                   allowedAddressPairs,

-                                                   securityGroups);

+                                                   Sets.newHashSet(allowedAddressPairs),

+                                                   Sets.newHashSet(securityGroups));

         vportMap.put(id, vPort);

 

         return Collections.unmodifiableCollection(vportMap.values());