protected JsonNode jsonPortStats(DeviceService deviceService, Iterable<Device> devices) {
        ObjectMapper mapper = new ObjectMapper();
        ArrayNode result = mapper.createArrayNode();

        for (Device device : devices) {
            result.add(jsonPortStats(device.id(), mapper, deviceService.getPortStatistics(device.id())));
        }

        return result;
    }
@Test
    public void testJsonPortStats() {

        JsonNode node = devicePortStatsCommand.jsonPortStats(deviceService, devices).get(0);

        assertEquals(node.findValue("deviceId").asText(), id1.toString());
        assertEquals(node.findValue("port").asText(), portStatistics.portNumber().toString());
        assertEquals(node.findValue("pktRx").asLong(), portStatistics.packetsReceived());
        assertEquals(node.findValue("pktTx").asLong(), portStatistics.packetsSent());
        assertEquals(node.findValue("bytesRx").asLong(), portStatistics.bytesReceived());
        assertEquals(node.findValue("bytesTx").asLong(), portStatistics.bytesSent());
        assertEquals(node.findValue("pktRxDrp").asLong(), portStatistics.packetsRxDropped());
        assertEquals(node.findValue("pktTxDrp").asLong(), portStatistics.packetsTxDropped());
        assertEquals(node.findValue("Dur").asLong(), portStatistics.durationSec());

    }