use of com.exalttech.trex.ui.models.PortStatus in project trex-stateless-gui by cisco-system-traffic-generator.
the class PortsManager method updatedPorts.
public void updatedPorts(List<Integer> portIndexes) {
List<Port> list = portList.stream().filter(port -> portIndexes.contains(port.getIndex())).collect(Collectors.toList());
try {
String response = ConnectionManager.getInstance().sendPortStatusRequest(list);
if (response == null) {
return;
}
List<PortStatus> portStatusList = mapper.readValue(response, mapper.getTypeFactory().constructCollectionType(List.class, PortStatus.class));
for (Port port : list) {
PortStatus.PortStatusResult portStatus = portStatusList.get(list.indexOf(port)).getResult();
port.setOwner(portStatus.getOwner());
port.setStatus(portStatus.getState());
port.setAttr(portStatus.getAttr());
port.setRx_info(portStatus.getRx_info());
port.setService(portStatus.getService());
port.linkProperty().set(portStatus.getAttr().getLink().getUp());
}
portManagerHandler.onPortListUpdated(true);
} catch (Exception ex) {
logger.error("Error reading port status", ex);
}
}
Aggregations