本文整理汇总了Java中org.opennms.netmgt.model.OnmsNode.getSysObjectId方法的典型用法代码示例。如果您正苦于以下问题:Java OnmsNode.getSysObjectId方法的具体用法?Java OnmsNode.getSysObjectId怎么用?Java OnmsNode.getSysObjectId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opennms.netmgt.model.OnmsNode
的用法示例。
在下文中一共展示了OnmsNode.getSysObjectId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSnmpNode
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
@Override
public LinkableNode getSnmpNode(final int nodeid) throws SQLException {
final OnmsCriteria criteria = new OnmsCriteria(OnmsNode.class);
criteria.createAlias("ipInterfaces", "iface", OnmsCriteria.LEFT_JOIN);
criteria.add(Restrictions.eq("type", "A"));
criteria.add(Restrictions.eq("iface.isSnmpPrimary", PrimaryType.PRIMARY));
criteria.add(Restrictions.eq("id", nodeid));
final List<OnmsNode> nodes = m_nodeDao.findMatching(criteria);
if (nodes.size() > 0) {
final OnmsNode node = nodes.get(0);
final String sysObjectId = node.getSysObjectId();
return new LinkableNode(node.getId(), node.getPrimaryInterface().getIpAddress(), sysObjectId == null? "-1" : sysObjectId);
} else {
return null;
}
}
示例2: testInitialSetup
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
@Test
@JUnitSnmpAgents({
@JUnitSnmpAgent(host="192.168.255.22", port=161, resource="classpath:/dw/walks/node1-walk.properties")
})
@JUnitTemporaryDatabase
public void testInitialSetup() throws Exception {
final InetAddress addr = InetAddressUtils.addr("192.168.255.22");
final EventAnticipator anticipator = m_eventSubscriber.getEventAnticipator();
anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_ADDED_EVENT_UEI, "Provisiond").setNodeid(1).getEvent());
anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_GAINED_INTERFACE_EVENT_UEI, "Provisiond").setNodeid(1).setInterface(InetAddressUtils.addr("192.168.255.22")).getEvent());
anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_GAINED_SERVICE_EVENT_UEI, "Provisiond").setNodeid(1).setInterface(InetAddressUtils.addr("192.168.255.22")).setService("SNMP").getEvent());
anticipator.anticipateEvent(new EventBuilder(EventConstants.NODE_GAINED_SERVICE_EVENT_UEI, "Provisiond").setNodeid(1).setInterface(InetAddressUtils.addr("192.168.255.22")).setService("ICMP").getEvent());
importResource("classpath:/dw/import/dw_test_import.xml");
anticipator.verifyAnticipated(200000, 0, 0, 0, 0);
final OnmsNode onmsNode = m_nodeDao.findByForeignId("dw", "arthur");
final String sysObjectId = onmsNode.getSysObjectId();
assertEquals(".1.3.6.1.4.1.7262.2.3", sysObjectId);
m_mockSnmpDataProvider.setDataForAddress(new SnmpAgentAddress(addr, 161), m_resourceLoader.getResource("classpath:/dw/walks/node3-walk.properties"));
assertEquals(".1.3.6.1.4.1.7262.1", SnmpUtils.get(m_snmpPeerFactory.getAgentConfig(addr), SnmpObjId.get(".1.3.6.1.2.1.1.2.0")).toDisplayString());
importResource("classpath:/dw/import/dw_test_import.xml");
final NodeScan scan2 = m_provisioner.createNodeScan(onmsNode.getId(), onmsNode.getForeignSource(), onmsNode.getForeignId());
runScan(scan2);
m_nodeDao.flush();
final OnmsNode node = m_nodeDao.findByForeignId("dw", "arthur");
final String sysObjectId2 = node.getSysObjectId();
assertEquals(".1.3.6.1.4.1.7262.1", sysObjectId2);
}
示例3: testASetup
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
@Test
@JUnitSnmpAgents({
@JUnitSnmpAgent(host="192.168.255.22", resource="classpath:/dw/walks/node3-walk.properties")
})
@JUnitTemporaryDatabase
public void testASetup() throws Exception {
importResource("classpath:/dw/import/dw_test_import.xml");
final OnmsNode onmsNode = m_nodeDao.findAll().get(0);
String sysObjectId = onmsNode.getSysObjectId();
assertEquals(".1.3.6.1.4.1.7262.1", sysObjectId);
}
示例4: isNodeReady
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
@Override
public boolean isNodeReady(AdapterOperation op) {
boolean readyState = false;
OnmsNode node = m_nodeDao.get(op.getNodeId());
if (node != null && node.getSysObjectId() != null) {
readyState = true;
}
return readyState;
}
示例5: getSnmpNodeList
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
@Override
public List<LinkableNode> getSnmpNodeList() throws SQLException {
final List<LinkableNode> nodes = new ArrayList<LinkableNode>();
final OnmsCriteria criteria = new OnmsCriteria(OnmsNode.class);
criteria.createAlias("ipInterfaces", "iface", OnmsCriteria.LEFT_JOIN);
criteria.add(Restrictions.eq("type", "A"));
criteria.add(Restrictions.eq("iface.isSnmpPrimary", PrimaryType.PRIMARY));
for (final OnmsNode node : m_nodeDao.findMatching(criteria)) {
final String sysObjectId = node.getSysObjectId();
nodes.add(new LinkableNode(node.getId(), node.getPrimaryInterface().getIpAddress(), sysObjectId == null? "-1" : sysObjectId));
}
return nodes;
}
示例6: getIconName
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
public static String getIconName(OnmsNode node) {
return node.getSysObjectId() == null ? "linkd:system" : "linkd:system:snmp:"+node.getSysObjectId();
}