当前位置: 首页>>代码示例>>Java>>正文


Java OnmsNode.getSysObjectId方法代码示例

本文整理汇总了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;
       }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:18,代码来源:HibernateEventWriter.java

示例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);
  }
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:38,代码来源:DragonWaveNodeSwitchingTest.java

示例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);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:15,代码来源:DragonWaveNodeSwitchingTest.java

示例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;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:11,代码来源:SnmpAssetProvisioningAdapter.java

示例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;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:16,代码来源:HibernateEventWriter.java

示例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();
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:4,代码来源:LinkdTopologyProvider.java


注:本文中的org.opennms.netmgt.model.OnmsNode.getSysObjectId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。