use of org.opennms.netmgt.config.hardware.HwExtension in project opennms by OpenNMS.
the class DefaultSnmpHwInventoryAdapterConfigDaoTest method testDuplicateOid.
/**
* Test duplicate OID.
*
* @throws Exception the exception
*/
@Test
public void testDuplicateOid() throws Exception {
initDao("src/test/resources/test-config-01.xml");
HwInventoryAdapterConfiguration cfg = dao.getConfiguration();
HwExtension ext = cfg.getExtensions().get(0);
Assert.assertEquals("CISCO-ENTITY-EXT-MIB", ext.getName());
Assert.assertEquals(5, ext.getMibObjects().size());
Assert.assertNull(ext.getMibObjectByAlias("ceExtNVRAMSize"));
}
use of org.opennms.netmgt.config.hardware.HwExtension in project opennms by OpenNMS.
the class SnmpHardwareInventoryProvisioningAdapterIT method testDiscoverSnmpEntities.
/**
* Test discover SNMP entities.
*
* @throws Exception the exception
*/
@Test
@Transactional
public void testDiscoverSnmpEntities() throws Exception {
HwInventoryAdapterConfiguration config = m_adapter.getHwAdapterConfigDao().getConfiguration();
Assert.assertEquals(3, config.getExtensions().size());
Assert.assertEquals(5, config.getExtensions().get(0).getMibObjects().size());
Assert.assertEquals(12, config.getExtensions().get(1).getMibObjects().size());
Assert.assertEquals(10, config.getExtensions().get(2).getMibObjects().size());
HwExtension ext = config.getExtensions().get(0);
Assert.assertEquals("CISCO-ENTITY-EXT-MIB", ext.getName());
Assert.assertEquals(5, ext.getMibObjects().size());
ext = config.getExtensions().get(1);
Assert.assertEquals("CISCO-ENTITY-ASSET-MIB", ext.getName());
Assert.assertEquals(12, ext.getMibObjects().size());
Assert.assertEquals(27, m_adapter.getVendorAttributeMap().size());
for (TestOperation op : m_operations) {
m_adapter.processPendingOperationForNode(op.operation);
OnmsHwEntity root = m_entityDao.findRootByNodeId(op.nodeId);
Assert.assertNotNull(root);
Assert.assertTrue(root.isRoot());
FileWriter w = new FileWriter("target/" + op.nodeId + ".xml");
JaxbUtils.marshal(root, w);
w.close();
m_nodeDao.flush();
m_entityDao.flush();
}
Assert.assertEquals(112, m_entityDao.countAll());
}
Aggregations