@Test
public void testSubNetFromJSon() throws Exception {

    String payload = "\n" +
            "\n" +
            "       {\n" +
            "           \"name\": \"dd\",\n" +
            "           \"enable_dhcp\": true,\n" +
            "           \"network_id\": \"33cb6d12-3792-4ff7-8abe-8f948ce60a4d\",\n" +
            "           \"tenant_id\": \"00000000000000000000000000000046\",\n" +
            "           \"dns_nameservers\":\n" +
            "           [\n" +
            "           ],\n" +
            "           \"allocation_pools\":\n" +
            "           [\n" +
            "               {\n" +
            "                   \"start\": \"12.1.0.2\",\n" +
            "                   \"end\": \"12.1.0.254\"\n" +
            "               }\n" +
            "           ],\n" +
            "           \"host_routes\":\n" +
            "           [\n" +
            "           ],\n" +
            "           \"ip_version\": 4,\n" +
            "           \"gateway_ip\": \"12.1.0.1\",\n" +
            "           \"cidr\": \"12.1.0.0/24\",\n" +
            "           \"id\": \"6959446a-204b-4e68-a5d2-f7a3ef5a442a\"\n" +
            "       }\n" +
            "\n";
    JSONObject jsonNet = new JSONObject(payload);
    SubNetworkInstance subnet = SubNetworkInstance.fromJson(jsonNet, "region");
    assertEquals(subnet.getIdNetwork(), "33cb6d12-3792-4ff7-8abe-8f948ce60a4d");
    assertEquals(subnet.getIdSubNet(), "6959446a-204b-4e68-a5d2-f7a3ef5a442a");
    assertEquals(subnet.getName(), "dd");
    assertEquals(subnet.getCidr(), "12.1.0.0/24");
    assertEquals(subnet.getRegion(), "region");
}