Network { public String getNetworkName() { return name; } Network();  Network(String name, String vdc, String region); void addSubNet(SubNetwork subNet); Set<SubNetwork> cloneSubNets(); void deleteSubNet(SubNetwork subNet); void updateSubNet(SubNetwork subNet); boolean contains(SubNetwork subNet); String getNetworkName(); String getRegion(); void setNetworkName(String name); String getVdc(); void setVdc(String vdc); void setFederatedNetwork(boolean federatedNetwork); boolean getfederatedNetwork(); void setFederatedRange(String range); String getFederatedRange(); Set<SubNetwork> getSubNets(); void setSubNets(Set<SubNetwork> subNets); NetworkDto toDto(); NetworkInstance toNetworkInstance(); @Override boolean equals(Object obj); @Override int hashCode(); String toString();  }
@Test public void testFromJSon() throws Exception { String payload = "{\"status\": \"ACTIVE\", " + " \"external_gateway_info\": { " + " \"network_id\": \"080b5f2a-668f-45e0-be23-361c3a7d11d0\" " + " }, " + " \"name\": \"test-rt1\", " + "\"admin_state_up\": true, " + "\"tenant_id\": \"08bed031f6c54c9d9b35b42aa06b51c0\", " + "\"routes\": [], " + "\"shared\": false, " + "\"router:external\": false, " + "\"id\": \"5af6238b-0e9c-4c20-8981-6e4db6de2e17\"" + "}"; JSONObject jsonNet = new JSONObject(payload); NetworkInstance net = NetworkInstance.fromJson(jsonNet, "region"); assertEquals(net.getIdNetwork(), "5af6238b-0e9c-4c20-8981-6e4db6de2e17"); assertEquals(net.getNetworkName(), "test-rt1"); assertEquals(net.getTenantId(), "08bed031f6c54c9d9b35b42aa06b51c0"); }