@Test
  public void testNodeConnectorStatisticsMethods() {
    NodeConnector nc =
        NodeConnectorCreator.createNodeConnector((short) 20, NodeCreator.createOFNode((long) 20));
    NodeConnectorStatistics ncStats = new NodeConnectorStatistics();
    ncStats.setNodeConnector(nc);
    ncStats.setReceiveByteCount(800);
    ncStats.setReceiveCRCErrorCount(10);
    ncStats.setReceiveDropCount(5);
    ncStats.setReceiveErrorCount(20);
    ncStats.setReceiveFrameErrorCount(25);
    ncStats.setReceiveOverRunErrorCount(30);
    ncStats.setReceivePacketCount(100);
    ncStats.setTransmitByteCount(400);
    ncStats.setTransmitDropCount(15);
    ncStats.setTransmitErrorCount(18);
    ncStats.setTransmitPacketCount(50);
    ncStats.setCollisionCount(2);

    Assert.assertTrue(ncStats.getCollisionCount() == 2);
    Assert.assertTrue(ncStats.getTransmitPacketCount() == 50);
    Assert.assertTrue(ncStats.getTransmitErrorCount() == 18);
    Assert.assertTrue(ncStats.getTransmitDropCount() == 15);
    Assert.assertTrue(ncStats.getReceivePacketCount() == 100);
    Assert.assertTrue(ncStats.getReceiveOverRunErrorCount() == 30);
    Assert.assertTrue(ncStats.getReceiveFrameErrorCount() == 25);
    Assert.assertTrue(ncStats.getReceiveDropCount() == 5);
    Assert.assertTrue(ncStats.getReceiveCRCErrorCount() == 10);
    Assert.assertTrue(ncStats.getReceiveByteCount() == 800);
    Assert.assertTrue(ncStats.getNodeConnector().equals(nc));
  }
  @Test
  public void testHostFind() throws UnknownHostException {

    assertNotNull(this.invtoryListener);

    // create one node and two node connectors
    Node node1 = NodeCreator.createOFNode(1L);
    NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector((short) 1, node1);
    NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1);

    // test addStaticHost(), put into inactive host DB if not verifiable
    Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, "0");
    st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", nc1_2, "0");

    HostNodeConnector hnc_1 = this.hosttracker.hostFind(InetAddress.getByName("192.168.0.8"));
    assertNull(hnc_1);

    this.invtoryListener.notifyNodeConnector(nc1_1, UpdateType.ADDED, null);

    hnc_1 = this.hosttracker.hostFind(InetAddress.getByName("192.168.0.8"));
    assertNotNull(hnc_1);
  }
  @Test
  public void testNotifyNodeConnector() throws UnknownHostException {
    String ip;

    assertNotNull(this.invtoryListener);

    // create one node and two node connectors
    Node node1 = NodeCreator.createOFNode(1L);
    NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector((short) 1, node1);
    NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1);

    // test addStaticHost(), put into inactive host DB if not verifiable
    Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, "0");
    st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", nc1_2, "0");

    this.invtoryListener.notifyNodeConnector(nc1_1, UpdateType.ADDED, null);

    // check all host list
    Iterator<HostNodeConnector> hnci = this.hosttracker.getAllHosts().iterator();
    while (hnci.hasNext()) {
      ip = hnci.next().getNetworkAddressAsString();
      Assert.assertTrue(ip.equals("192.168.0.8"));
    }

    // check active host DB
    hnci = this.hosttracker.getActiveStaticHosts().iterator();
    while (hnci.hasNext()) {
      ip = hnci.next().getNetworkAddressAsString();
      Assert.assertTrue(ip.equals("192.168.0.8"));
    }

    // check inactive host DB
    hnci = this.hosttracker.getInactiveStaticHosts().iterator();
    while (hnci.hasNext()) {
      ip = hnci.next().getNetworkAddressAsString();
      Assert.assertTrue(ip.equals("192.168.0.13"));
    }
  }
  @Test
  public void testStaticHost() throws UnknownHostException {
    String ip;

    assertNotNull(this.hosttracker);

    // create one node and two node connectors
    Node node1 = NodeCreator.createOFNode(1L);
    NodeConnector nc1_1 = NodeConnectorCreator.createOFNodeConnector((short) 1, node1);
    NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1);

    // test addStaticHost(), store into inactive host DB
    Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, "0");
    Assert.assertTrue(st.isSuccess());
    st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", nc1_2, "0");
    Assert.assertTrue(st.isSuccess());

    // check inactive DB
    Iterator<HostNodeConnector> hnci = this.hosttracker.getInactiveStaticHosts().iterator();
    while (hnci.hasNext()) {
      ip = hnci.next().getNetworkAddressAsString();
      Assert.assertTrue(ip.equals("192.168.0.8") || ip.equals("192.168.0.13"));
    }

    // check active host DB
    hnci = this.hosttracker.getActiveStaticHosts().iterator();
    Assert.assertFalse(hnci.hasNext());

    // test removeStaticHost()
    st = this.hosttracker.removeStaticHost("192.168.0.8");
    Assert.assertTrue(st.isSuccess());

    hnci = this.hosttracker.getInactiveStaticHosts().iterator();
    while (hnci.hasNext()) {
      ip = hnci.next().getNetworkAddressAsString();
      Assert.assertTrue(ip.equals("192.168.0.13"));
    }
  }