use of org.openkilda.integration.model.PortsDetail in project open-kilda by telstra.
the class PortConverter method toPortsInfo.
/**
* To ports info.
*
* @param jsonObject the json object
* @param switchId the switch id
* @return the list
* @throws JsonParseException the json parse exception
* @throws JsonMappingException the json mapping exception
* @throws IOException Signals that an I/O exception has occurred.
*/
public static List<PortInfo> toPortsInfo(final JSONObject jsonObject, final String switchId) throws JsonParseException, JsonMappingException, IOException {
List<PortInfo> ports = new ArrayList<PortInfo>();
if (jsonObject != null) {
Object object = jsonObject.get(switchId);
if (object != null) {
String val = JSONValue.toJSONString(object);
PortsDetail portsDetail = JsonUtil.toObject(val, PortsDetail.class);
List<PortDetail> portDetailList = portsDetail.getPortDetail();
if (portDetailList != null && !portDetailList.isEmpty()) {
ports = getPortsInfo(portDetailList, switchId, ports);
}
}
}
return ports;
}
Aggregations