protected static String getNodeTooltipText(
      OnmsNode node, AbstractVertex vertex, OnmsIpInterface ip) {
    StringBuffer tooltipText = new StringBuffer();

    /*
    if (node.getSysDescription() != null && node.getSysDescription().length() >0) {
        tooltipText.append(HTML_TOOLTIP_TAG_OPEN);
        tooltipText.append("Description: " + node.getSysDescription());
        tooltipText.append(HTML_TOOLTIP_TAG_END);
    }
    */

    tooltipText.append(HTML_TOOLTIP_TAG_OPEN);
    tooltipText.append(
        "Management IP and Name: " + vertex.getIpAddress() + " (" + vertex.getLabel() + ")");
    tooltipText.append(HTML_TOOLTIP_TAG_END);

    if (node.getSysLocation() != null && node.getSysLocation().length() > 0) {
      tooltipText.append(HTML_TOOLTIP_TAG_OPEN);
      tooltipText.append("Location: " + node.getSysLocation());
      tooltipText.append(HTML_TOOLTIP_TAG_END);
    }

    tooltipText.append(HTML_TOOLTIP_TAG_OPEN);
    tooltipText.append("Status: " + getNodeStatusString(node.getType()));
    if (ip != null && ip.isManaged()) {
      tooltipText.append(" / Managed");
    } else {
      tooltipText.append(" / Unmanaged");
    }
    tooltipText.append(HTML_TOOLTIP_TAG_END);

    return tooltipText.toString();
  }
 protected AbstractVertex getVertex(OnmsNode onmsnode) {
   OnmsIpInterface ip = getAddress(onmsnode);
   AbstractVertex vertex =
       new SimpleLeafVertex(TOPOLOGY_NAMESPACE_LINKD, onmsnode.getNodeId(), 0, 0);
   vertex.setIconKey(getIconName(onmsnode));
   vertex.setLabel(onmsnode.getLabel());
   vertex.setIpAddress(ip == null ? null : ip.getIpAddress().getHostAddress());
   vertex.setNodeID(Integer.parseInt(onmsnode.getNodeId()));
   vertex.setTooltipText(getNodeTooltipText(onmsnode, vertex, ip));
   return vertex;
 }
 protected OnmsIpInterface getAddress(OnmsNode node) {
   // OnmsIpInterface ip = node.getPrimaryInterface();
   OnmsIpInterface ip = getIpInterfaceDao().findPrimaryInterfaceByNodeId(node.getId());
   if (ip == null) {
     //            for (OnmsIpInterface iterip: node.getIpInterfaces()) {
     for (OnmsIpInterface iterip : getIpInterfaceDao().findByNodeId(node.getId())) {
       ip = iterip;
       break;
     }
   }
   return ip;
 }
  @Override
  public VertexHopGraphProvider.VertexHopCriteria getDefaultCriteria() {
    final OnmsNode node = m_topologyDao.getDefaultFocusPoint();

    VertexHopGraphProvider.VertexHopCriteria criterion = null;

    if (node != null) {
      final Vertex defaultVertex = getVertex(node);
      if (defaultVertex != null) {
        criterion = new LinkdHopCriteria(node.getNodeId(), node.getLabel(), m_nodeDao);
      }
    }

    return criterion;
  }
  @Override
  public VertexHopGraphProvider.VertexHopCriteria getDefaultCriteria() {
    final OnmsNode node = m_topologyDao.getDefaultFocusPoint();

    VertexHopGraphProvider.VertexHopCriteria criterion = null;

    if (node != null) {
      final Vertex defaultVertex = getVertex(TOPOLOGY_NAMESPACE_LINKD, node.getNodeId());
      if (defaultVertex != null) {
        VertexHopGraphProvider.FocusNodeHopCriteria hopCriteria =
            new VertexHopGraphProvider.FocusNodeHopCriteria();
        hopCriteria.add(defaultVertex);
        return hopCriteria;
      }
    }

    return criterion;
  }
  @Before
  public void setUp() {
    m_node1 = new OnmsNode();
    m_node1.setId(1);

    m_node2 = new OnmsNode();
    m_node2.setId(2);

    m_nodeChennai = new OnmsNode();
    m_nodeChennai.setId(14);

    m_nodeDehli = new OnmsNode();
    m_nodeDehli.setId(10);

    m_alarmDao = EasyMock.createMock(AlarmDao.class);
    m_ospfLinkDao = EasyMock.createMock(OspfLinkDao.class);

    m_statusProvider = new OspfLinkStatusProvider();
    m_statusProvider.setAlarmDao(m_alarmDao);
    m_statusProvider.setOspfLinkDao(m_ospfLinkDao);

    m_edgeProvider = EasyMock.createMock(EdgeProvider.class);
  }
 public static String getIconName(OnmsNode node) {
   return node.getSysObjectId() == null
       ? "linkd:system"
       : "linkd:system:snmp:" + node.getSysObjectId();
 }