Search in sources :

Example 71 with OnmsSnmpInterface

use of org.opennms.netmgt.model.OnmsSnmpInterface in project opennms by OpenNMS.

the class IpInterfaceDaoHibernateIT method setUp.

@Before
public void setUp() {
    m_databasePopulator.populateDatabase();
    // Set the primary address of Node2 as the test address.
    m_testAddress = m_databasePopulator.getNode2().getPrimaryInterface().getIpAddress();
    // Adding the test address as a secondary address (unmanaged) to Node1
    OnmsNode n1 = m_databasePopulator.getNode1();
    OnmsIpInterface iface = new OnmsIpInterface(m_testAddress.getHostAddress(), n1);
    iface.setIsManaged("U");
    iface.setIsSnmpPrimary(PrimaryType.SECONDARY);
    OnmsSnmpInterface snmpIf = new OnmsSnmpInterface(n1, 1001);
    iface.setSnmpInterface(snmpIf);
    snmpIf.getIpInterfaces().add(iface);
    n1.addIpInterface(iface);
    m_databasePopulator.getNodeDao().save(n1);
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) OnmsIpInterface(org.opennms.netmgt.model.OnmsIpInterface) OnmsSnmpInterface(org.opennms.netmgt.model.OnmsSnmpInterface) Before(org.junit.Before)

Example 72 with OnmsSnmpInterface

use of org.opennms.netmgt.model.OnmsSnmpInterface in project opennms by OpenNMS.

the class SnmpIfCollectorIT method createSnmpInterface.

private OnmsEntity createSnmpInterface(final int ifIndex, final int ifType, final String ifName, final boolean collectionEnabled) {
    final OnmsSnmpInterface m_snmpIface = new OnmsSnmpInterface();
    m_snmpIface.setIfIndex(ifIndex);
    m_snmpIface.setIfType(ifType);
    m_snmpIface.setIfName(ifName);
    m_snmpIface.setCollectionEnabled(collectionEnabled);
    m_node.addSnmpInterface(m_snmpIface);
    return m_snmpIface;
}
Also used : OnmsSnmpInterface(org.opennms.netmgt.model.OnmsSnmpInterface)

Example 73 with OnmsSnmpInterface

use of org.opennms.netmgt.model.OnmsSnmpInterface in project opennms by OpenNMS.

the class NetworkElementFactory method getSnmpInterface.

/* (non-Javadoc)
	 * @see org.opennms.web.element.NetworkElementFactoryInterface#getSnmpInterface(int, int)
	 */
@Override
public Interface getSnmpInterface(int nodeId, int ifIndex) {
    OnmsCriteria criteria = new OnmsCriteria(OnmsSnmpInterface.class);
    criteria.createAlias("node", "node");
    criteria.add(Restrictions.eq("node.id", nodeId));
    criteria.add(Restrictions.eq("ifIndex", ifIndex));
    List<OnmsSnmpInterface> snmpIfaces = m_snmpInterfaceDao.findMatching(criteria);
    if (snmpIfaces.size() > 0) {
        return new Interface(snmpIfaces.get(0));
    }
    return null;
}
Also used : OnmsSnmpInterface(org.opennms.netmgt.model.OnmsSnmpInterface) OnmsCriteria(org.opennms.netmgt.model.OnmsCriteria) OnmsSnmpInterface(org.opennms.netmgt.model.OnmsSnmpInterface) OnmsIpInterface(org.opennms.netmgt.model.OnmsIpInterface)

Aggregations

OnmsSnmpInterface (org.opennms.netmgt.model.OnmsSnmpInterface)73 OnmsIpInterface (org.opennms.netmgt.model.OnmsIpInterface)39 OnmsNode (org.opennms.netmgt.model.OnmsNode)38 Test (org.junit.Test)17 InetAddress (java.net.InetAddress)16 OnmsAlarm (org.opennms.netmgt.model.OnmsAlarm)10 NorthboundAlarm (org.opennms.netmgt.alarmd.api.NorthboundAlarm)9 OnmsEvent (org.opennms.netmgt.model.OnmsEvent)9 Transactional (org.springframework.transaction.annotation.Transactional)9 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)8 OnmsEventParameter (org.opennms.netmgt.model.OnmsEventParameter)8 LinkedHashSet (java.util.LinkedHashSet)5 LinkedList (java.util.LinkedList)5 HashSet (java.util.HashSet)4 List (java.util.List)4 Before (org.junit.Before)4 CriteriaBuilder (org.opennms.core.criteria.CriteriaBuilder)4 IpNetToMedia (org.opennms.netmgt.model.IpNetToMedia)4 OnmsMonitoredService (org.opennms.netmgt.model.OnmsMonitoredService)4