private void updateSnmpDataForSnmpInterfaces() { if (m_collector != null && m_collector.hasIfTable()) { for (IfTableEntry entry : m_collector.getIfTable()) { Integer ifIndex = entry.getIfIndex(); if (ifIndex == null) continue; LOG.debug("Updating SNMP Interface with ifIndex {}", ifIndex); // first look to see if an snmpIf was created already OnmsSnmpInterface snmpIf = m_node.getSnmpInterfaceWithIfIndex(ifIndex); if (snmpIf == null) { // if not then create one snmpIf = new OnmsSnmpInterface(m_node, ifIndex); } snmpIf.setIfAlias(m_collector.getIfAlias(ifIndex)); snmpIf.setIfName(m_collector.getIfName(ifIndex)); snmpIf.setIfType(getIfType(ifIndex)); snmpIf.setNetMask(getNetMask(ifIndex)); snmpIf.setIfAdminStatus(getAdminStatus(ifIndex)); snmpIf.setIfDescr(m_collector.getIfDescr(ifIndex)); snmpIf.setIfSpeed(m_collector.getInterfaceSpeed(ifIndex)); snmpIf.setPhysAddr(m_collector.getPhysAddr(ifIndex)); } } }
private void updateSnmpDataForInterface(OnmsIpInterface ipIf) { if (m_collector == null || !m_collector.hasIpAddrTable() || !m_collector.hasIfTable()) { return; } final InetAddress inetAddr = ipIf.getIpAddress(); final String ipAddr = InetAddressUtils.str(inetAddr); LOG.debug("Creating SNMP info for interface {}", ipAddr); int ifIndex = m_collector.getIfIndex(inetAddr); if (ifIndex == -1) { return; } // first look to see if an snmpIf was created already OnmsSnmpInterface snmpIf = m_node.getSnmpInterfaceWithIfIndex(ifIndex); if (snmpIf == null) { // if not then create one snmpIf = new OnmsSnmpInterface(m_node, ifIndex); snmpIf.setIfAlias(m_collector.getIfAlias(ifIndex)); snmpIf.setIfName(m_collector.getIfName(ifIndex)); snmpIf.setIfType(getIfType(ifIndex)); snmpIf.setNetMask(getNetMask(ifIndex)); snmpIf.setIfAdminStatus(getAdminStatus(ifIndex)); snmpIf.setIfDescr(m_collector.getIfDescr(ifIndex)); snmpIf.setIfSpeed(m_collector.getInterfaceSpeed(ifIndex)); snmpIf.setPhysAddr(m_collector.getPhysAddr(ifIndex)); } snmpIf.setCollectionEnabled(true); ipIf.setSnmpInterface(snmpIf); // FIXME: Improve OpenNMS to provide these values // ifOperStatus }