示例#1
0
  /** {@inheritDoc} */
  public DiscoveryLink getDiscoveryLink(final String pkgName) {
    final Package pkg = m_linkdConfig.getPackage(pkgName);

    if (pkg == null) return null;

    final DiscoveryLink discoveryLink = new DiscoveryLink();
    discoveryLink.setLinkd(this);
    discoveryLink.setPackageName(pkg.getName());
    discoveryLink.setInitialSleepTime(m_linkdConfig.getInitialSleepTime());

    discoveryLink.setSnmpPollInterval(
        pkg.hasSnmp_poll_interval()
            ? pkg.getSnmp_poll_interval()
            : m_linkdConfig.getSnmpPollInterval());
    discoveryLink.setDiscoveryInterval(
        pkg.hasDiscovery_link_interval()
            ? pkg.getDiscovery_link_interval()
            : m_linkdConfig.getDiscoveryLinkInterval());
    discoveryLink.setDiscoveryUsingBridge(
        pkg.hasUseBridgeDiscovery()
            ? pkg.getUseBridgeDiscovery()
            : m_linkdConfig.useBridgeDiscovery());
    discoveryLink.setDiscoveryUsingCdp(
        pkg.hasUseCdpDiscovery() ? pkg.getUseCdpDiscovery() : m_linkdConfig.useCdpDiscovery());
    discoveryLink.setDiscoveryUsingRoutes(
        pkg.hasUseIpRouteDiscovery()
            ? pkg.getUseIpRouteDiscovery()
            : m_linkdConfig.useIpRouteDiscovery());
    discoveryLink.setEnableDownloadDiscovery(
        pkg.hasEnableDiscoveryDownload()
            ? pkg.getEnableDiscoveryDownload()
            : m_linkdConfig.enableDiscoveryDownload());
    discoveryLink.setForceIpRouteDiscoveryOnEtherNet(
        pkg.hasForceIpRouteDiscoveryOnEthernet()
            ? pkg.getForceIpRouteDiscoveryOnEthernet()
            : m_linkdConfig.forceIpRouteDiscoveryOnEthernet());

    return discoveryLink;
  }
示例#2
0
  private void populateSnmpCollection(
      final SnmpCollection coll, final Package pkg, final String sysoid) {
    coll.setPackageName(pkg.getName());
    coll.setInitialSleepTime(m_linkdConfig.getInitialSleepTime());
    coll.setPollInterval(
        pkg.hasSnmp_poll_interval()
            ? pkg.getSnmp_poll_interval()
            : m_linkdConfig.getSnmpPollInterval());
    // TODO: Put this logic inside LinkdConfigManager
    if (m_linkdConfig.hasIpRouteClassName(sysoid)) {
      coll.setIpRouteClass(m_linkdConfig.getIpRouteClassName(sysoid));
      LogUtils.debugf(
          this, "populateSnmpCollection: found class to get ipRoute: %s", coll.getIpRouteClass());
    } else {
      coll.setIpRouteClass(m_linkdConfig.getDefaultIpRouteClassName());
      LogUtils.debugf(
          this,
          "populateSnmpCollection: Using default class to get ipRoute: %s",
          coll.getIpRouteClass());
    }

    if (pkg.hasEnableVlanDiscovery()
        && pkg.getEnableVlanDiscovery()
        && m_linkdConfig.hasClassName(sysoid)) {
      coll.setVlanClass(m_linkdConfig.getVlanClassName(sysoid));
      LogUtils.debugf(
          this, "populateSnmpCollection: found class to get Vlans: %s", coll.getVlanClass());
    } else if (!pkg.hasEnableVlanDiscovery()
        && m_linkdConfig.isVlanDiscoveryEnabled()
        && m_linkdConfig.hasClassName(sysoid)) {
      coll.setVlanClass(m_linkdConfig.getVlanClassName(sysoid));
      LogUtils.debugf(
          this, "populateSnmpCollection: found class to get Vlans: %s", coll.getVlanClass());
    } else {
      LogUtils.debugf(
          this,
          "populateSnmpCollection: no class found to get Vlans or VlanDiscoveryDisabled for Package: %s",
          pkg.getName());
    }

    coll.collectCdpTable(
        pkg.hasUseCdpDiscovery() ? pkg.getUseCdpDiscovery() : m_linkdConfig.useCdpDiscovery());

    final boolean useIpRouteDiscovery =
        (pkg.hasUseIpRouteDiscovery()
            ? pkg.getUseIpRouteDiscovery()
            : m_linkdConfig.useIpRouteDiscovery());
    final boolean saveRouteTable =
        (pkg.hasSaveRouteTable() ? pkg.getSaveRouteTable() : m_linkdConfig.saveRouteTable());

    coll.SaveIpRouteTable(saveRouteTable);
    coll.collectIpRouteTable(useIpRouteDiscovery || saveRouteTable);

    final boolean useBridgeDiscovery =
        (pkg.hasUseBridgeDiscovery()
            ? pkg.getUseBridgeDiscovery()
            : m_linkdConfig.useBridgeDiscovery());
    coll.collectBridgeForwardingTable(useBridgeDiscovery);

    final boolean saveStpNodeTable =
        (pkg.hasSaveStpNodeTable() ? pkg.getSaveStpNodeTable() : m_linkdConfig.saveStpNodeTable());

    coll.saveStpNodeTable(saveStpNodeTable);
    coll.collectStpNode(useBridgeDiscovery || saveStpNodeTable);

    final boolean saveStpInterfaceTable =
        (pkg.hasSaveStpInterfaceTable()
            ? pkg.getSaveStpInterfaceTable()
            : m_linkdConfig.saveStpInterfaceTable());

    coll.saveStpInterfaceTable(saveStpInterfaceTable);
    coll.collectStpTable(useBridgeDiscovery || saveStpInterfaceTable);
  }