Ejemplo n.º 1
0
  @Test
  @JUnitSnmpAgents(
      value = {@JUnitSnmpAgent(host = Sluck001_IP, port = 161, resource = Sluck001_SNMP_RESOURCE)})
  public void testNetworkLinksCiscoJuniperVlan() throws Exception {

    m_nodeDao.save(builder.getSluck001());
    m_nodeDao.flush();

    Package example1 = m_linkdConfig.getPackage("example1");
    example1.setUseIsisDiscovery(false);
    example1.setUseIpRouteDiscovery(false);
    example1.setUseOspfDiscovery(false);
    example1.setUseLldpDiscovery(false);
    example1.setUseCdpDiscovery(false);
    example1.setUseBridgeDiscovery(false);

    example1.setEnableVlanDiscovery(true);

    example1.setSaveStpNodeTable(false);
    example1.setSaveStpInterfaceTable(false);
    example1.setSaveRouteTable(false);

    final OnmsNode switchCisco = m_nodeDao.findByForeignId("linkd", Sluck001_NAME);

    assertTrue(m_linkd.scheduleNodeCollection(switchCisco.getId()));

    assertTrue(m_linkd.runSingleSnmpCollection(switchCisco.getId()));

    assertEquals(7, m_vlanDao.countAll());
  }
Ejemplo n.º 2
0
  /*
       * fixed a fake link found using cdp:
       * caused by duplicated ip address
  s     * r-uk-nott-newt-103:Fa0:(1)<------>(4):Fa3:r-ro-suce-pict-001
       */
  @Test
  @JUnitSnmpAgents(
      value = {
        @JUnitSnmpAgent(host = RPict001_IP, port = 161, resource = RPict001_SNMP_RESOURCE),
        @JUnitSnmpAgent(host = RNewt103_IP, port = 161, resource = RNewt103_SNMP_RESOURCE)
      })
  public void testCdpFakeLinkRoUk() throws Exception {

    m_nodeDao.save(builder.getRPict001());
    m_nodeDao.save(builder.getRNewt103());
    m_nodeDao.flush();

    Package example1 = m_linkdConfig.getPackage("example1");
    example1.setUseIsisDiscovery(false);
    example1.setUseIpRouteDiscovery(false);
    example1.setUseOspfDiscovery(false);
    example1.setUseLldpDiscovery(false);
    example1.setUseCdpDiscovery(true);
    example1.setUseBridgeDiscovery(false);

    example1.setEnableVlanDiscovery(false);

    example1.setSaveStpNodeTable(false);
    example1.setSaveStpInterfaceTable(false);
    example1.setSaveRouteTable(false);

    final OnmsNode routerRo = m_nodeDao.findByForeignId("linkd", RPict001_NAME);
    final OnmsNode routerUk = m_nodeDao.findByForeignId("linkd", RNewt103_NAME);

    assertTrue(m_linkd.scheduleNodeCollection(routerRo.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(routerUk.getId()));

    assertTrue(m_linkd.runSingleSnmpCollection(routerRo.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(routerUk.getId()));

    assertEquals(0, m_dataLinkInterfaceDao.countAll());

    assertTrue(m_linkd.runSingleLinkDiscovery("example1"));

    assertEquals(0, m_dataLinkInterfaceDao.countAll());
  }
Ejemplo n.º 3
0
  /*
   * We want to test that the next hop router discovered
   * links can be discovered using the ospf neb table
   */
  @Test
  @JUnitSnmpAgents(
      value = {
        @JUnitSnmpAgent(host = PENROSE_IP, port = 161, resource = PENROSE_SNMP_RESOURCE),
        @JUnitSnmpAgent(host = DELAWARE_IP, port = 161, resource = DELAWARE_SNMP_RESOURCE)
      })
  public void testNetwork1055StpLinks() throws Exception {
    m_nodeDao.save(builder.getPenrose());
    m_nodeDao.save(builder.getDelaware());
    m_nodeDao.flush();

    Package example1 = m_linkdConfig.getPackage("example1");
    example1.setUseBridgeDiscovery(true);
    example1.setUseLldpDiscovery(false);
    example1.setUseCdpDiscovery(false);
    example1.setUseIpRouteDiscovery(false);
    example1.setUseOspfDiscovery(false);
    example1.setUseIsisDiscovery(false);

    example1.setSaveRouteTable(false);
    example1.setSaveStpInterfaceTable(false);
    example1.setSaveStpNodeTable(false);

    final OnmsNode penrose = m_nodeDao.findByForeignId("linkd", PENROSE_NAME);
    final OnmsNode delaware = m_nodeDao.findByForeignId("linkd", DELAWARE_NAME);

    assertTrue(m_linkd.scheduleNodeCollection(penrose.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(delaware.getId()));

    assertTrue(m_linkd.runSingleSnmpCollection(penrose.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(delaware.getId()));

    assertEquals(0, m_dataLinkInterfaceDao.countAll());

    assertTrue(m_linkd.runSingleLinkDiscovery("example1"));

    assertEquals(1, m_dataLinkInterfaceDao.countAll());
  }
Ejemplo n.º 4
0
  @Test
  @JUnitSnmpAgents(
      value = {
        @JUnitSnmpAgent(host = RDeEssnBrue_IP, port = 161, resource = RDeEssnBrue_SNMP_RESOURCE),
        @JUnitSnmpAgent(
            host = SDeEssnBrue081_IP,
            port = 161,
            resource = SDeEssnBrue081_SNMP_RESOURCE),
        @JUnitSnmpAgent(
            host = SDeEssnBrue121_IP,
            port = 161,
            resource = SDeEssnBrue121_SNMP_RESOURCE),
        @JUnitSnmpAgent(
            host = SDeEssnBrue142_IP,
            port = 161,
            resource = SDeEssnBrue142_SNMP_RESOURCE),
        @JUnitSnmpAgent(
            host = SDeEssnBrue165_IP,
            port = 161,
            resource = SDeEssnBrue165_SNMP_RESOURCE)
      })
  public void testCiscoAlcatelEssnBrueLldp() {

    m_nodeDao.save(builder.getRDeEssnBrue());
    m_nodeDao.save(builder.getSDeEssnBrue081());
    m_nodeDao.save(builder.getSDeEssnBrue121());
    m_nodeDao.save(builder.getSDeEssnBrue142());
    m_nodeDao.save(builder.getSDeEssnBrue165());
    m_nodeDao.flush();

    Package example1 = m_linkdConfig.getPackage("example1");
    example1.setUseIsisDiscovery(false);
    example1.setUseIpRouteDiscovery(false);
    example1.setUseOspfDiscovery(false);
    example1.setUseLldpDiscovery(true);
    example1.setUseCdpDiscovery(false);
    example1.setUseBridgeDiscovery(false);

    example1.setEnableVlanDiscovery(false);

    example1.setSaveStpNodeTable(false);
    example1.setSaveStpInterfaceTable(false);
    example1.setSaveRouteTable(false);

    HibernateEventWriter queryManager = (HibernateEventWriter) m_linkd.getQueryManager();

    assertEquals(
        107,
        queryManager.getFromSysnameIfName(RDeEssnBrue_NAME, "Gi1/3/11").getIfIndex().intValue());
    assertEquals(
        260,
        queryManager.getFromSysnameIfName(RDeEssnBrue_NAME, "Gi2/3/11").getIfIndex().intValue());

    assertEquals(
        1025,
        queryManager.getFromSysnameIfIndex(SDeEssnBrue165_NAME, 1025).getIfIndex().intValue());
    assertEquals(
        2025,
        queryManager.getFromSysnameIfName(SDeEssnBrue165_NAME, "2/25").getIfIndex().intValue());

    final OnmsNode routerCisco = m_nodeDao.findByForeignId("linkd", RDeEssnBrue_NAME);
    final OnmsNode swicthAlu081 = m_nodeDao.findByForeignId("linkd", SDeEssnBrue081_NAME);
    final OnmsNode swicthAlu121 = m_nodeDao.findByForeignId("linkd", SDeEssnBrue121_NAME);
    final OnmsNode swicthAlu142 = m_nodeDao.findByForeignId("linkd", SDeEssnBrue142_NAME);
    final OnmsNode swicthAlu165 = m_nodeDao.findByForeignId("linkd", SDeEssnBrue165_NAME);

    assertTrue(m_linkd.scheduleNodeCollection(routerCisco.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(swicthAlu081.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(swicthAlu121.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(swicthAlu142.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(swicthAlu165.getId()));

    assertTrue(m_linkd.runSingleSnmpCollection(routerCisco.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(swicthAlu081.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(swicthAlu121.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(swicthAlu142.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(swicthAlu165.getId()));

    assertEquals(0, m_dataLinkInterfaceDao.countAll());

    assertTrue(m_linkd.runSingleLinkDiscovery("example1"));

    for (DataLinkInterface link : m_dataLinkInterfaceDao.findAll()) {
      printLink(link);
    }

    assertEquals(6, m_dataLinkInterfaceDao.countAll());
  }
Ejemplo n.º 5
0
  /*
   *
   *  Get only ospf links.
   */
  @Test
  @JUnitSnmpAgents(
      value = {
        @JUnitSnmpAgent(
            host = MUMBAI_IP,
            port = 161,
            resource = "classpath:linkd/nms10205/" + MUMBAI_NAME + "_" + MUMBAI_IP + ".txt"),
        @JUnitSnmpAgent(
            host = CHENNAI_IP,
            port = 161,
            resource = "classpath:linkd/nms10205/" + CHENNAI_NAME + "_" + CHENNAI_IP + ".txt"),
        @JUnitSnmpAgent(
            host = DELHI_IP,
            port = 161,
            resource = "classpath:linkd/nms10205/" + DELHI_NAME + "_" + DELHI_IP + ".txt"),
        @JUnitSnmpAgent(
            host = BANGALORE_IP,
            port = 161,
            resource = "classpath:linkd/nms10205/" + BANGALORE_NAME + "_" + BANGALORE_IP + ".txt"),
        @JUnitSnmpAgent(
            host = BAGMANE_IP,
            port = 161,
            resource = "classpath:linkd/nms10205/" + BAGMANE_NAME + "_" + BAGMANE_IP + ".txt"),
        @JUnitSnmpAgent(
            host = MYSORE_IP,
            port = 161,
            resource = "classpath:linkd/nms10205/" + MYSORE_NAME + "_" + MYSORE_IP + ".txt"),
        @JUnitSnmpAgent(
            host = SPACE_EX_SW1_IP,
            port = 161,
            resource =
                "classpath:linkd/nms10205/" + SPACE_EX_SW1_NAME + "_" + SPACE_EX_SW1_IP + ".txt"),
        @JUnitSnmpAgent(
            host = SPACE_EX_SW2_IP,
            port = 161,
            resource =
                "classpath:linkd/nms10205/" + SPACE_EX_SW2_NAME + "_" + SPACE_EX_SW2_IP + ".txt"),
        @JUnitSnmpAgent(
            host = J6350_41_IP,
            port = 161,
            resource = "classpath:linkd/nms10205/" + J6350_41_NAME + "_" + J6350_41_IP + ".txt"),
        @JUnitSnmpAgent(
            host = J6350_42_IP,
            port = 161,
            resource = "classpath:linkd/nms10205/" + "J6350-42_" + J6350_42_IP + ".txt"),
        @JUnitSnmpAgent(
            host = SRX_100_IP,
            port = 161,
            resource = "classpath:linkd/nms10205/" + "SRX-100_" + SRX_100_IP + ".txt"),
        @JUnitSnmpAgent(
            host = SSG550_IP,
            port = 161,
            resource = "classpath:linkd/nms10205/" + SSG550_NAME + "_" + SSG550_IP + ".txt")
      })
  public void testNetwork10205OspfLinks() throws Exception {
    m_nodeDao.save(getMumbai());
    m_nodeDao.save(getChennai());
    m_nodeDao.save(getDelhi());
    m_nodeDao.save(getBangalore());
    m_nodeDao.save(getBagmane());
    m_nodeDao.save(getMysore());
    m_nodeDao.save(getSpaceExSw1());
    m_nodeDao.save(getSpaceExSw2());
    m_nodeDao.save(getJ635041());
    m_nodeDao.save(getJ635042());
    m_nodeDao.save(getSRX100());
    m_nodeDao.save(getSGG550());
    m_nodeDao.flush();

    Package example1 = m_linkdConfig.getPackage("example1");
    example1.setUseLldpDiscovery(false);
    example1.setUseCdpDiscovery(false);
    example1.setUseBridgeDiscovery(false);
    example1.setUseIpRouteDiscovery(false);

    example1.setSaveRouteTable(false);
    example1.setSaveStpInterfaceTable(false);
    example1.setSaveStpNodeTable(false);

    final OnmsNode mumbai = m_nodeDao.findByForeignId("linkd", MUMBAI_NAME);
    final OnmsNode chennai = m_nodeDao.findByForeignId("linkd", CHENNAI_NAME);
    final OnmsNode delhi = m_nodeDao.findByForeignId("linkd", DELHI_NAME);
    final OnmsNode bangalore = m_nodeDao.findByForeignId("linkd", BANGALORE_NAME);
    final OnmsNode bagmane = m_nodeDao.findByForeignId("linkd", BAGMANE_NAME);
    final OnmsNode mysore = m_nodeDao.findByForeignId("linkd", MYSORE_NAME);
    final OnmsNode spaceexsw1 = m_nodeDao.findByForeignId("linkd", SPACE_EX_SW1_NAME);
    final OnmsNode spaceexsw2 = m_nodeDao.findByForeignId("linkd", SPACE_EX_SW2_NAME);
    final OnmsNode j635041 = m_nodeDao.findByForeignId("linkd", J6350_41_NAME);
    final OnmsNode j635042 = m_nodeDao.findByForeignId("linkd", J6350_42_NAME);
    final OnmsNode srx100 = m_nodeDao.findByForeignId("linkd", SRX_100_NAME);
    final OnmsNode ssg550 = m_nodeDao.findByForeignId("linkd", SSG550_NAME);

    assertTrue(m_linkd.scheduleNodeCollection(chennai.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(mumbai.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(delhi.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(bangalore.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(bagmane.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(mysore.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(spaceexsw1.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(spaceexsw2.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(j635041.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(j635042.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(srx100.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(ssg550.getId()));

    assertTrue(m_linkd.runSingleSnmpCollection(mumbai.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(chennai.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(delhi.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(bangalore.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(bagmane.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(mysore.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(spaceexsw1.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(spaceexsw2.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(j635041.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(j635042.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(srx100.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(ssg550.getId()));

    assertEquals(0, m_dataLinkInterfaceDao.countAll());

    assertTrue(m_linkd.runSingleLinkDiscovery("example1"));

    final List<DataLinkInterface> links = m_dataLinkInterfaceDao.findAll();

    assertEquals(9, links.size());

    int start = getStartPoint(links);
    for (final DataLinkInterface datalinkinterface : links) {
      int id = datalinkinterface.getId().intValue();
      if (start == id) {
        checkLink(chennai, mumbai, 528, 520, datalinkinterface);
      } else if (start + 1 == id) {
        checkLink(delhi, mumbai, 28503, 519, datalinkinterface);
      } else if (start + 2 == id) {
        checkLink(bangalore, mumbai, 2401, 507, datalinkinterface);
      } else if (start + 3 == id) {
        checkLink(bagmane, mumbai, 534, 977, datalinkinterface);
      } else if (start + 4 == id) {
        checkLink(mysore, mumbai, 508, 978, datalinkinterface);
      } else if (start + 5 == id) {
        checkLink(mysore, chennai, 505, 517, datalinkinterface);
      } else if (start + 6 == id) {
        checkLink(bangalore, delhi, 2397, 3674, datalinkinterface);
      } else if (start + 7 == id) {
        checkLink(bagmane, bangalore, 1732, 2396, datalinkinterface);
      } else if (start + 8 == id) {
        checkLink(mysore, bagmane, 520, 654, datalinkinterface);
      } else {
        checkLink(mumbai, mumbai, -1, -1, datalinkinterface);
      }
    }
  }
Ejemplo n.º 6
0
  /*
   * We want to test that the next hop router discovered
   * links can be discovered using the ospf neb table
   */
  @Test
  @JUnitSnmpAgents(
      value = {
        @JUnitSnmpAgent(host = PENROSE_IP, port = 161, resource = PENROSE_SNMP_RESOURCE),
        @JUnitSnmpAgent(host = DELAWARE_IP, port = 161, resource = DELAWARE_SNMP_RESOURCE),
        @JUnitSnmpAgent(host = PHOENIX_IP, port = 161, resource = PHOENIX_SNMP_RESOURCE),
        @JUnitSnmpAgent(host = AUSTIN_IP, port = 161, resource = AUSTIN_SNMP_RESOURCE),
        @JUnitSnmpAgent(host = SANJOSE_IP, port = 161, resource = SANJOSE_SNMP_RESOURCE),
        @JUnitSnmpAgent(host = RIOVISTA_IP, port = 161, resource = RIOVISTA_SNMP_RESOURCE)
      })
  public void testNetwork1055OspfLinks() throws Exception {
    m_nodeDao.save(builder.getPenrose());
    m_nodeDao.save(builder.getDelaware());
    m_nodeDao.save(builder.getPhoenix());
    m_nodeDao.save(builder.getAustin());
    m_nodeDao.save(builder.getSanjose());
    m_nodeDao.save(builder.getRiovista());
    m_nodeDao.flush();

    Package example1 = m_linkdConfig.getPackage("example1");
    example1.setUseBridgeDiscovery(false);
    example1.setUseLldpDiscovery(false);
    example1.setUseCdpDiscovery(false);
    example1.setUseIpRouteDiscovery(false);
    example1.setUseOspfDiscovery(true);
    example1.setUseIsisDiscovery(false);

    example1.setSaveRouteTable(false);
    example1.setSaveStpInterfaceTable(false);
    example1.setSaveStpNodeTable(false);
    m_linkdConfig.update();

    final OnmsNode penrose = m_nodeDao.findByForeignId("linkd", PENROSE_NAME);
    final OnmsNode delaware = m_nodeDao.findByForeignId("linkd", DELAWARE_NAME);
    final OnmsNode phoenix = m_nodeDao.findByForeignId("linkd", PHOENIX_NAME);
    final OnmsNode austin = m_nodeDao.findByForeignId("linkd", AUSTIN_NAME);
    final OnmsNode sanjose = m_nodeDao.findByForeignId("linkd", SANJOSE_NAME);
    final OnmsNode riovista = m_nodeDao.findByForeignId("linkd", RIOVISTA_NAME);

    assertTrue(m_linkd.scheduleNodeCollection(penrose.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(delaware.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(phoenix.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(austin.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(sanjose.getId()));
    assertTrue(m_linkd.scheduleNodeCollection(riovista.getId()));

    assertTrue(m_linkd.runSingleSnmpCollection(penrose.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(delaware.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(phoenix.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(austin.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(sanjose.getId()));
    assertTrue(m_linkd.runSingleSnmpCollection(riovista.getId()));

    assertEquals(0, m_dataLinkInterfaceDao.countAll());

    assertTrue(m_linkd.runSingleLinkDiscovery("example1"));

    assertEquals(5, m_dataLinkInterfaceDao.countAll());
    final List<DataLinkInterface> links = m_dataLinkInterfaceDao.findAll();

    final int start = getStartPoint(links);
    for (final DataLinkInterface datalinkinterface : links) {
      Integer linkid = datalinkinterface.getId();
      if (linkid == start) {
        // penrose  -> delaware --ip route next hop
        checkLink(delaware, penrose, 598, 535, datalinkinterface);
      } else if (linkid == start + 1) {
        // penrose   -> phoenix     --ip route next hop
        checkLink(phoenix, penrose, 564, 644, datalinkinterface);
      } else if (linkid == start + 2) {
        // phoenix  -> austin --ip route next hop
        checkLink(austin, phoenix, 554, 565, datalinkinterface);
      } else if (linkid == start + 3) {
        // phoenix  -> sanjose --ip route next hop
        checkLink(sanjose, phoenix, 564, 566, datalinkinterface);
      } else if (linkid == start + 4) {
        // austin  -> sanjose --ip route next hop
        checkLink(sanjose, austin, 8562, 586, datalinkinterface);
      } else {
        // error
        checkLink(penrose, penrose, -1, -1, datalinkinterface);
      }
    }
  }