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);
}
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;
}
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;
}
Aggregations