Addressed the error in retrieving subnets 86/96186/1
authorRamesh Parthasarathy <ramesh.parthasarathy@att.com>
Tue, 24 Sep 2019 17:11:35 +0000 (10:11 -0700)
committerRamesh Parthasarathy <ramesh.parthasarathy@att.com>
Tue, 24 Sep 2019 17:13:40 +0000 (10:13 -0700)
Addressed the error in retrieving subnets
with SO Libs repository openstack SDK project

Issue-ID: SO-2361
Signed-off-by: Ramesh Parthasarathy(rp6768)<ramesh.parthasarathy@att.com>
Change-Id: If54a8097ca16a266b075d3e5bfcf09157947087d

quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routes.java [new file with mode: 0644]
quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java
quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetTest.java
quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetsTest.java

diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routes.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routes.java
new file mode 100644 (file)
index 0000000..4a93253
--- /dev/null
@@ -0,0 +1,59 @@
+/*-
+ * ============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.quantum.model;
+
+import java.io.Serializable;
+
+public class Routes implements Serializable {
+
+    private String destination;
+    private String nexthop;
+
+    /**
+     * @return the destination
+     */
+    public String getDestination() {
+        return destination;
+    }
+
+    /**
+     * @param destination the destination to set
+     */
+    public void setDestination(String destination) {
+        this.destination = destination;
+    }
+
+    /**
+     * @return the nexthop
+     */
+    public String getNexthop() {
+        return nexthop;
+    }
+
+    /**
+     * @param nexthop the nexthop to set
+     */
+    public void setNexthop(String nexthop) {
+        this.nexthop = nexthop;
+    }
+
+    @Override
+    public String toString() {
+        return "host_routes [destination=" + destination + ", nexthop=" + nexthop + "]";
+    }
+
+}
index f47f25d..38485a3 100644 (file)
@@ -53,7 +53,7 @@ public class Subnet implements Serializable {
     private List<Pool> list;
 
     @JsonProperty("host_routes")
-    private List<String> hostRoutes;
+    private List<Routes> hostRoutes;
 
     @JsonProperty("service_types")
     private List<String> serviceTypes;
@@ -202,14 +202,14 @@ public class Subnet implements Serializable {
     /**
      * @return the hostRoutes
      */
-    public List<String> getHostRoutes() {
+    public List<Routes> getHostRoutes() {
         return hostRoutes;
     }
 
     /**
      * @param hostRoutes the hostRoutes to set
      */
-    public void setHostRoutes(List<String> hostRoutes) {
+    public void setHostRoutes(List<Routes> hostRoutes) {
         this.hostRoutes = hostRoutes;
     }
 
index 11c178b..9973ec0 100644 (file)
@@ -41,7 +41,9 @@ public class SubnetTest {
             + "    \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL + "    \"allocation_pools\" : [ {"
             + EOL + "      \"start\" : \"start\"," + EOL + "      \"end\" : \"end\"" + EOL + "    }, {" + EOL
             + "      \"start\" : \"start\"," + EOL + "      \"end\" : \"end\"" + EOL + "    } ]," + EOL
-            + "    \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL + "    \"ip_version\" : 4," + EOL
+            + "    \"host_routes\" : [ {" + EOL + "      \"destination\" : \"destination\"," + EOL
+            + "      \"nexthop\" : \"nexthop\"" + EOL + "    }, {" + EOL + "      \"destination\" : \"destination\","
+            + EOL + "      \"nexthop\" : \"nexthop\"" + EOL + "    } ]," + EOL + "    \"ip_version\" : 4," + EOL
             + "    \"gateway_ip\" : \"gw\"" + EOL + "  }" + EOL + "}";
 
     private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
@@ -73,7 +75,7 @@ public class SubnetTest {
         Assert.assertEquals(2, dnsNames.size());
         subnet.setDnsNames(dnsNames);
 
-        List<String> hostRoutes = subnet.getHostRoutes();
+        List<Routes> hostRoutes = subnet.getHostRoutes();
         Assert.assertNotNull(hostRoutes);
         Assert.assertEquals(2, hostRoutes.size());
         subnet.setHostRoutes(hostRoutes);
index 02f4c75..cfab9fe 100644 (file)
@@ -40,14 +40,18 @@ public class SubnetsTest {
             + "    \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL + "    \"allocation_pools\" : [ {"
             + EOL + "      \"start\" : \"start\"," + EOL + "      \"end\" : \"end\"" + EOL + "    }, {" + EOL
             + "      \"start\" : \"start\"," + EOL + "      \"end\" : \"end\"" + EOL + "    } ]," + EOL
-            + "    \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL + "    \"ip_version\" : 4," + EOL
+            + "    \"host_routes\" : [ {" + EOL + "      \"destination\" : \"destination\"," + EOL
+            + "      \"nexthop\" : \"nexthop\"" + EOL + "    }, {" + EOL + "      \"destination\" : \"destination\","
+            + EOL + "      \"nexthop\" : \"nexthop\"" + EOL + "    } ]," + EOL + "    \"ip_version\" : 4," + EOL
             + "    \"gateway_ip\" : \"gw\"" + EOL + "  }, {" + EOL + "    \"name\" : \"name\"," + EOL
             + "    \"cidr\" : \"cidr\"," + EOL + "    \"enable_dhcp\" : true," + EOL
             + "    \"network_id\" : \"networkid\"," + EOL + "    \"tenant_id\" : \"tenantid\"," + EOL
             + "    \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL + "    \"allocation_pools\" : [ {"
             + EOL + "      \"start\" : \"start\"," + EOL + "      \"end\" : \"end\"" + EOL + "    }, {" + EOL
             + "      \"start\" : \"start\"," + EOL + "      \"end\" : \"end\"" + EOL + "    } ]," + EOL
-            + "    \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL + "    \"ip_version\" : 4," + EOL
+            + "    \"host_routes\" : [ {" + EOL + "      \"destination\" : \"destination\"," + EOL
+            + "      \"nexthop\" : \"nexthop\"" + EOL + "    }, {" + EOL + "      \"destination\" : \"destination\","
+            + EOL + "      \"nexthop\" : \"nexthop\"" + EOL + "    } ]," + EOL + "    \"ip_version\" : 4," + EOL
             + "    \"gateway_ip\" : \"gw\"" + EOL + "  } ]" + EOL + "}";
 
     private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)