@Test
  @JUnitTemporaryDatabase // Relies on records created in @Before so we need a fresh database
  public void testUpdateNode() throws InterruptedException {
    AdapterOperationChecker verifyOperations = new AdapterOperationChecker(2);
    m_adapter.getOperationQueue().addListener(verifyOperations);

    try {
      OnmsNode node = m_nodeDao.get(NODE_ID);
      assertNotNull(node);
      int firstNodeId = node.getId();

      assertNull(node.getAssetRecord().getComment());
      m_adapter.addNode(firstNodeId);
      m_adapter.updateNode(firstNodeId);

      assertTrue(verifyOperations.enqueueLatch.await(4, TimeUnit.SECONDS));
      assertTrue(verifyOperations.dequeueLatch.await(4, TimeUnit.SECONDS));
      assertTrue(verifyOperations.executeLatch.await(4, TimeUnit.SECONDS));
      assertEquals(0, m_adapter.getOperationQueue().getOperationQueueForNode(firstNodeId).size());

      node = m_nodeDao.get(firstNodeId);
      assertNotNull(node);
      System.out.println("ID: " + node.getAssetRecord().getId());
      System.out.println("Comment: " + node.getAssetRecord().getComment());
      assertNotNull("AssetRecord comment is null", node.getAssetRecord().getComment());
      assertEquals(EXPECTED_COMMENT_FIELD, node.getAssetRecord().getComment());
    } finally {
      m_adapter.getOperationQueue().removeListener(verifyOperations);
    }
  }
  @Test
  @JUnitTemporaryDatabase // Relies on records created in @Before so we need a fresh database
  @Transactional
  public void testAddNodeDirectly() throws InterruptedException {
    OnmsNode node = m_nodeDao.get(NODE_ID);
    assertNotNull(node);
    int firstNodeId = node.getId();

    m_adapter.doAddNode(firstNodeId);

    node = m_nodeDao.get(firstNodeId);
    assertNotNull(node);
    assertNotNull("AssetRecord comment is null", node.getAssetRecord().getComment());
    assertEquals(EXPECTED_COMMENT_FIELD, node.getAssetRecord().getComment());
  }
コード例 #3
0
 /** {@inheritDoc} */
 @Override
 public void foundAsset(String name, String value) {
   BeanWrapper w = PropertyAccessorFactory.forBeanPropertyAccess(m_node.getAssetRecord());
   try {
     w.setPropertyValue(name, value);
   } catch (BeansException e) {
     LOG.warn("Could not set property on asset: {}", name, e);
   }
 }
コード例 #4
0
 /**
  * Constructor for AbstractSaveOrUpdateOperation.
  *
  * @param nodeId a {@link java.lang.Integer} object.
  * @param foreignSource a {@link java.lang.String} object.
  * @param foreignId a {@link java.lang.String} object.
  * @param nodeLabel a {@link java.lang.String} object.
  * @param building a {@link java.lang.String} object.
  * @param city a {@link java.lang.String} object.
  */
 public AbstractSaveOrUpdateOperation(
     final Integer nodeId,
     final String foreignSource,
     final String foreignId,
     final String nodeLabel,
     final String building,
     final String city) {
   m_node = new OnmsNode();
   m_node.setId(nodeId);
   m_node.setLabel(nodeLabel);
   m_node.setLabelSource(NodeLabelSource.USER);
   m_node.setType(NodeType.ACTIVE);
   m_node.setForeignSource(foreignSource);
   m_node.setForeignId(foreignId);
   m_node.getAssetRecord().setBuilding(building);
   m_node.getAssetRecord().setCity(city);
 }
コード例 #5
0
  private void declareBeans(BSFManager bsfManager) throws BSFException {
    NodeDao nodeDao = Notifd.getInstance().getNodeDao();
    Integer nodeId;
    try {
      nodeId = Integer.valueOf(m_notifParams.get(NotificationManager.PARAM_NODE));
    } catch (NumberFormatException nfe) {
      nodeId = null;
    }

    OnmsNode node = null;
    OnmsAssetRecord assets = null;
    List<String> categories = new ArrayList<String>();
    String nodeLabel = null;
    String foreignSource = null;
    String foreignId = null;

    if (nodeId != null) {
      node = nodeDao.get(nodeId);
      nodeLabel = node.getLabel();
      assets = node.getAssetRecord();
      for (OnmsCategory cat : node.getCategories()) {
        categories.add(cat.getName());
      }
      foreignSource = node.getForeignSource();
      foreignId = node.getForeignId();
    }

    bsfManager.declareBean("bsf_notif_strategy", this, BSFNotificationStrategy.class);

    retrieveParams();
    bsfManager.declareBean("notif_params", m_notifParams, Map.class);

    bsfManager.declareBean("node_label", nodeLabel, String.class);
    bsfManager.declareBean("foreign_source", foreignSource, String.class);
    bsfManager.declareBean("foreign_id", foreignId, String.class);
    bsfManager.declareBean("node_assets", assets, OnmsAssetRecord.class);
    bsfManager.declareBean("node_categories", categories, List.class);
    bsfManager.declareBean("node", node, OnmsNode.class);

    for (Argument arg : m_arguments) {
      if (NotificationManager.PARAM_TEXT_MSG.equals(arg.getSwitch()))
        bsfManager.declareBean("text_message", arg.getValue(), String.class);
      if (NotificationManager.PARAM_NUM_MSG.equals(arg.getSwitch()))
        bsfManager.declareBean("numeric_message", arg.getValue(), String.class);
      if (NotificationManager.PARAM_NODE.equals(arg.getSwitch()))
        bsfManager.declareBean("node_id", arg.getValue(), String.class);
      if (NotificationManager.PARAM_INTERFACE.equals(arg.getSwitch()))
        bsfManager.declareBean("ip_addr", arg.getValue(), String.class);
      if (NotificationManager.PARAM_SERVICE.equals(arg.getSwitch()))
        bsfManager.declareBean("svc_name", arg.getValue(), String.class);
      if (NotificationManager.PARAM_SUBJECT.equals(arg.getSwitch()))
        bsfManager.declareBean("subject", arg.getValue(), String.class);
      if (NotificationManager.PARAM_EMAIL.equals(arg.getSwitch()))
        bsfManager.declareBean("email", arg.getValue(), String.class);
      if (NotificationManager.PARAM_PAGER_EMAIL.equals(arg.getSwitch()))
        bsfManager.declareBean("pager_email", arg.getValue(), String.class);
      if (NotificationManager.PARAM_XMPP_ADDRESS.equals(arg.getSwitch()))
        bsfManager.declareBean("xmpp_address", arg.getValue(), String.class);
      if (NotificationManager.PARAM_TEXT_PAGER_PIN.equals(arg.getSwitch()))
        bsfManager.declareBean("text_pin", arg.getValue(), String.class);
      if (NotificationManager.PARAM_NUM_PAGER_PIN.equals(arg.getSwitch()))
        bsfManager.declareBean("numeric_pin", arg.getValue(), String.class);
      if (NotificationManager.PARAM_WORK_PHONE.equals(arg.getSwitch()))
        bsfManager.declareBean("work_phone", arg.getValue(), String.class);
      if (NotificationManager.PARAM_HOME_PHONE.equals(arg.getSwitch()))
        bsfManager.declareBean("home_phone", arg.getValue(), String.class);
      if (NotificationManager.PARAM_MOBILE_PHONE.equals(arg.getSwitch()))
        bsfManager.declareBean("mobile_phone", arg.getValue(), String.class);
      if (NotificationManager.PARAM_TUI_PIN.equals(arg.getSwitch()))
        bsfManager.declareBean("phone_pin", arg.getValue(), String.class);
      if (NotificationManager.PARAM_MICROBLOG_USERNAME.equals(arg.getSwitch()))
        bsfManager.declareBean("microblog_username", arg.getValue(), String.class);
    }
  }
コード例 #6
0
  /**
   * This method queries the Vmware vCenter server for sensor data.
   *
   * @param svc the monitored service
   * @param parameters the parameter map
   * @return the poll status for this system
   */
  @Override
  public PollStatus poll(MonitoredService svc, Map<String, Object> parameters) {
    OnmsNode onmsNode = m_nodeDao.get(svc.getNodeId());

    // retrieve the assets and
    String vmwareManagementServer = onmsNode.getAssetRecord().getVmwareManagementServer();
    String vmwareManagedEntityType = onmsNode.getAssetRecord().getVmwareManagedEntityType();
    String vmwareManagedObjectId = onmsNode.getForeignId();

    TimeoutTracker tracker = new TimeoutTracker(parameters, DEFAULT_RETRY, DEFAULT_TIMEOUT);

    PollStatus serviceStatus = PollStatus.unknown();

    for (tracker.reset();
        tracker.shouldRetry() && !serviceStatus.isAvailable();
        tracker.nextAttempt()) {

      VmwareViJavaAccess vmwareViJavaAccess = null;

      try {
        vmwareViJavaAccess = new VmwareViJavaAccess(vmwareManagementServer);
      } catch (MarshalException e) {
        logger.warn(
            "Error initialising VMware connection to '{}': '{}'",
            vmwareManagementServer,
            e.getMessage());
        return PollStatus.unavailable(
            "Error initialising VMware connection to '" + vmwareManagementServer + "'");
      } catch (ValidationException e) {
        logger.warn(
            "Error initialising VMware connection to '{}': '{}'",
            vmwareManagementServer,
            e.getMessage());
        return PollStatus.unavailable(
            "Error initialising VMware connection to '" + vmwareManagementServer + "'");
      } catch (IOException e) {
        logger.warn(
            "Error initialising VMware connection to '{}': '{}'",
            vmwareManagementServer,
            e.getMessage());
        return PollStatus.unavailable(
            "Error initialising VMware connection to '" + vmwareManagementServer + "'");
      }

      try {
        vmwareViJavaAccess.connect();
      } catch (MalformedURLException e) {
        logger.warn(
            "Error connecting VMware management server '{}': '{}'",
            vmwareManagementServer,
            e.getMessage());
        return PollStatus.unavailable(
            "Error connecting VMware management server '" + vmwareManagementServer + "'");
      } catch (RemoteException e) {
        logger.warn(
            "Error connecting VMware management server '{}': '{}'",
            vmwareManagementServer,
            e.getMessage());
        return PollStatus.unavailable(
            "Error connecting VMware management server '" + vmwareManagementServer + "'");
      }

      if (!vmwareViJavaAccess.setTimeout(tracker.getConnectionTimeout())) {
        logger.warn(
            "Error setting connection timeout for VMware management server '{}'",
            vmwareManagementServer);
      }

      String powerState = "unknown";

      if ("HostSystem".equals(vmwareManagedEntityType)) {
        HostSystem hostSystem =
            vmwareViJavaAccess.getHostSystemByManagedObjectId(vmwareManagedObjectId);
        if (hostSystem == null) {
          return PollStatus.unknown("hostSystem=null");
        } else {
          HostRuntimeInfo hostRuntimeInfo = hostSystem.getRuntime();
          if (hostRuntimeInfo == null) {
            return PollStatus.unknown("hostRuntimeInfo=null");
          } else {
            HostSystemPowerState hostSystemPowerState = hostRuntimeInfo.getPowerState();
            if (hostSystemPowerState == null) {
              return PollStatus.unknown("hostSystemPowerState=null");
            } else {
              powerState = hostSystemPowerState.toString();
            }
          }
        }
      } else {
        if ("VirtualMachine".equals(vmwareManagedEntityType)) {
          VirtualMachine virtualMachine =
              vmwareViJavaAccess.getVirtualMachineByManagedObjectId(vmwareManagedObjectId);
          if (virtualMachine == null) {
            return PollStatus.unknown("virtualMachine=null");
          } else {
            VirtualMachineRuntimeInfo virtualMachineRuntimeInfo = virtualMachine.getRuntime();
            if (virtualMachineRuntimeInfo == null) {
              return PollStatus.unknown("virtualMachineRuntimeInfo=null");
            } else {
              VirtualMachinePowerState virtualMachinePowerState =
                  virtualMachineRuntimeInfo.getPowerState();
              if (virtualMachinePowerState == null) {
                return PollStatus.unknown("virtualMachinePowerState=null");
              } else {
                powerState = virtualMachinePowerState.toString();
              }
            }
          }
        } else {
          logger.warn(
              "Error getting '{}' for '{}'", vmwareManagedEntityType, vmwareManagedObjectId);

          vmwareViJavaAccess.disconnect();

          return serviceStatus;
        }
      }

      if ("poweredOn".equals(powerState)) {
        serviceStatus = PollStatus.available();
      } else {
        serviceStatus = PollStatus.unavailable("The system's state is '" + powerState + "'");
      }

      vmwareViJavaAccess.disconnect();
    }

    return serviceStatus;
  }
コード例 #7
0
  /**
   * doUpdate
   *
   * @param nodeId a int.
   * @param retry a boolean.
   * @throws org.opennms.netmgt.provision.ProvisioningAdapterException if any.
   */
  @Override
  public void doUpdateNode(final int nodeId) throws ProvisioningAdapterException {
    log().debug("doUpdate: updating nodeid: " + nodeId);

    final OnmsNode node = m_nodeDao.get(nodeId);
    Assert.notNull(node, "doUpdate: failed to return node for given nodeId:" + nodeId);

    final InetAddress ipaddress =
        m_template.execute(
            new TransactionCallback<InetAddress>() {
              public InetAddress doInTransaction(final TransactionStatus arg0) {
                return getIpForNode(node);
              }
            });

    final SnmpAgentConfig agentConfig = m_snmpConfigDao.getAgentConfig(ipaddress);

    final OnmsAssetRecord asset = node.getAssetRecord();
    m_config.getReadLock().lock();
    try {
      for (AssetField field : m_config.getAssetFieldsForAddress(ipaddress, node.getSysObjectId())) {
        try {
          String value =
              fetchSnmpAssetString(agentConfig, field.getMibObjs(), field.getFormatString());
          if (log().isDebugEnabled()) {
            log()
                .debug(
                    "doUpdate: Setting asset field \"" + field.getName() + "\" to value: " + value);
          }
          // Use Spring bean-accessor classes to set the field value
          BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(asset);
          try {
            wrapper.setPropertyValue(field.getName(), value);
          } catch (BeansException e) {
            log()
                .warn(
                    "doUpdate: Could not set property \""
                        + field.getName()
                        + "\" on asset object: "
                        + e.getMessage(),
                    e);
          }
        } catch (MissingFormatArgumentException e) {
          // This exception is thrown if the SNMP operation fails or an incorrect number of
          // parameters is returned by the agent or because of a misconfiguration.
          log()
              .warn(
                  "doUpdate: Could not set value for asset field \""
                      + field.getName()
                      + "\": "
                      + e.getMessage(),
                  e);
        }
      }
    } finally {
      m_config.getReadLock().unlock();
    }
    node.setAssetRecord(asset);
    m_nodeDao.saveOrUpdate(node);
    m_nodeDao.flush();
  }
コード例 #8
0
ファイル: OnmsNode.java プロジェクト: eatlunchnow/opennms
 /**
  * Simply replaces the current asset record with the new record
  *
  * @param scannedNode a {@link org.opennms.netmgt.model.OnmsNode} object.
  */
 public void replaceCurrentAssetRecord(OnmsNode scannedNode) {
   scannedNode.getAssetRecord().setId(this.getAssetRecord().getId());
   scannedNode.setId(this.m_id); // just in case
   this.setAssetRecord(scannedNode.getAssetRecord());
 }
コード例 #9
0
ファイル: OnmsNode.java プロジェクト: eatlunchnow/opennms
 /**
  * Truly merges the node's assert record
  *
  * @param scannedNode a {@link org.opennms.netmgt.model.OnmsNode} object.
  */
 public void mergeAssets(OnmsNode scannedNode) {
   this.getAssetRecord().mergeRecord(scannedNode.getAssetRecord());
 }
コード例 #10
0
  /**
   * This method maps OpenNMS alarm to an OSS/J alarms and adds additional information
   *
   * @param _openNMSalarm data to use to populate the OSS/J alarm
   * @param alarmValueSpecification AlarmValue object to be populated - Invariant (Specifcation)
   *     values should be already populated
   * @return the _av OSS/J AlarmValue populated with opennms data
   * @throws java.lang.IllegalArgumentException if any.
   * @throws javax.oss.UnsupportedAttributeException if any.
   */
  public AlarmValue populateOssjAlarmFromOpenNMSAlarm(
      AlarmValue alarmValueSpecification, OnmsAlarm _openNMSalarm)
      throws IllegalArgumentException, UnsupportedAttributeException {
    ThreadCategory log = getLog();
    String logheader =
        "\t\t" + this.getClass().getSimpleName() + "populateOssjAlarmFromOpenNMSAlarm():";

    // Node node = null;
    OnmsNode node = null;

    // Asset asset = null;
    OnmsAssetRecord asset = null;

    boolean isQoSDrxAlarm = false; // true if alarm is received from Qosdrx

    if (log.isDebugEnabled()) log.debug(logheader + ": Populating alarm");

    // test to see if opennms alarm already has type and instance information set. If yes then it
    // has most likely
    // come from Qosdrx.
    if ((_openNMSalarm.getManagedObjectInstance() != null)
        && (_openNMSalarm.getManagedObjectType() != null)
        && (!_openNMSalarm.getManagedObjectInstance().equals(""))
        && (!_openNMSalarm.getManagedObjectType().equals(""))) {
      isQoSDrxAlarm = true;
      if (log.isDebugEnabled())
        log.debug(
            logheader
                + ": isQoSDrxAlarm TRUE - because OpenNMS alarm has ManagedObjectInstance and ManagedObjectType");
    } else {
      isQoSDrxAlarm = false;
      if (log.isDebugEnabled())
        log.debug(
            logheader
                + ": isQoSDrxAlarm FALSE - because OpenNMS alarm NOT POPULATED ManagedObjectInstance and ManagedObjectType");
    }

    try {
      // If the alarm has both an acknowledge time and an acknowledge user
      // then the alarm has been acknowledged. Set the corrsponding parameters
      // in the OSS/J alarm
      if ((null != _openNMSalarm.getAlarmAckTime()) && (null != _openNMSalarm.getAlarmAckUser())) {
        alarmValueSpecification.setAckUserId(_openNMSalarm.getAlarmAckUser());
        // OnmsAlarm can contain java.sql.Timestamp - convert to Date
        alarmValueSpecification.setAckTime(new Date(_openNMSalarm.getAlarmAckTime().getTime()));
        alarmValueSpecification.setAlarmAckState(AlarmAckState.ACKNOWLEDGED);
      } else {
        alarmValueSpecification.setAlarmAckState(AlarmAckState.UNACKNOWLEDGED);
      }

      // if the alarm is cleared, then set the alarm cleared time
      // to that of the lasteventtime as this must be the time
      // the clear occured.
      if (_openNMSalarm.getSeverity() == OnmsSeverity.CLEARED) {
        // OnmsAlarm can contain java.sql.Timestamp - convert to Date
        alarmValueSpecification.setAlarmClearedTime(
            new Date(_openNMSalarm.getLastEventTime().getTime()));
      } else {
        alarmValueSpecification.setAlarmClearedTime(null);
      }

      // Set the alarmRaisedTime to the FirstEventTime of the OpenNMS
      // alarm. Set the alarm changed time to the last event time.
      // OnmsAlarm can contain java.sql.Timestamp - convert to Date
      if (null != _openNMSalarm.getFirstEventTime()) {
        alarmValueSpecification.setAlarmRaisedTime(
            new Date(_openNMSalarm.getFirstEventTime().getTime()));
      }
      if (null != _openNMSalarm.getLastEventTime()) {
        alarmValueSpecification.setAlarmChangedTime(
            new Date(_openNMSalarm.getLastEventTime().getTime()));
      }

    } catch (Throwable e) {
      log.error(logheader + ": Problem getting ACK time information", e);
    }

    Matcher matcher = null;
    String _uei_no_html = "NOT_SET";
    try {
      String uei = _openNMSalarm.getUei();
      if (null != uei) {
        matcher = p.matcher(uei);
        _uei_no_html = matcher.replaceAll(" "); // remove any HTML tags from uei
      }
      alarmValueSpecification.setAlarmType(
          (_openNMSalarm.getX733AlarmType() == null)
              ? javax.oss.fm.monitor.AlarmType.EQUIPMENT_ALARM
              : _openNMSalarm.getX733AlarmType());
    } catch (Throwable e) {
      log.error(logheader + ": Problem getting  X733AlarmType or Uei", e);
    }

    // Get some local node information as to where the alarm came from
    // This includes, what type of managed element the node is
    // and what its node id and label are.*/
    //		String mftr = "NOT_SET"; // FIXME: Not read
    //		String modelNo = "NOT_SET"; // FIXME: Not read
    //		String assetserno = "NOT_SET"; // FIXME: Not read
    //		String nodelabel = "NOT_SET"; // FIXME: Not read
    //		String alarmIP = "NOT_SET"; // FIXME: Not read
    String managedObjectType = "NOT_SET";
    String managedObjectInstance = "NOT_SET";
    String assetManagedObjectType = "NOT_SET";
    String assetManagedObjectInstance = "NOT_SET";

    String assetDescription = "NOT_SET";
    String assetAddress2 = "NOT_SET";

    if (!isQoSDrxAlarm) { // if is locally generated alarm
      try {
        // some opennms alarms don't have node information
        // set default values if no node information present
        if (_openNMSalarm.getNode() != null) {
          node = ossDao.findNodeByID(_openNMSalarm.getNode().getId());

          asset = node.getAssetRecord();

          //					alarmIP = _openNMSalarm.getIpAddr(); // Not read
          //					if (node != null) {
          //					nodelabel = node.getLabel(); // Not read
          //					}
          if (asset != null) {
            //						if (asset.getManufacturer()!= null) mftr = asset.getManufacturer(); // Not read
            //						if (asset.getModelNumber()!= null) modelNo = asset.getModelNumber(); // Not read
            //						if (asset.getSerialNumber()!= null) assetserno = asset.getSerialNumber(); // Not
            // read
            if (asset.getDescription() != null)
              assetDescription =
                  asset.getDescription(); // TODO was used for managed object class as is 128 char
            // long
            if (asset.getAddress2() != null)
              assetAddress2 =
                  asset.getAddress2(); // TODO was used for managed object instance - as is 256 char
            // long string
            if (asset.getManagedObjectInstance() != null)
              assetManagedObjectInstance = asset.getManagedObjectInstance();
            if (asset.getManagedObjectType() != null)
              assetManagedObjectType = asset.getManagedObjectType();
          }

          managedObjectInstance = assetManagedObjectInstance;
          managedObjectType = assetManagedObjectType;

          if (log.isDebugEnabled())
            log.debug(
                logheader
                    + ": isQoSDrxAlarm=FALSE  OpenNMS type and instance not set. Using from Node Asset record: ManagedObjectInstance: "
                    + managedObjectInstance
                    + " ManagedObjectType:"
                    + managedObjectType);
        }
      } catch (Throwable ex) {
        log.error(logheader + ": Problem getting node and asset information", ex);
      }
    } else { // is a received alarm
      try {
        managedObjectInstance = _openNMSalarm.getManagedObjectInstance();
        managedObjectType = _openNMSalarm.getManagedObjectType();

        if (log.isDebugEnabled())
          log.debug(
              logheader
                  + ": isQoSDrxAlarm=TRUE  OpenNMS type and instance set. Using from OnmsAlarm: ManagedObjectInstance: "
                  + managedObjectInstance
                  + " ManagedObjectType:"
                  + managedObjectType);
      } catch (Throwable ex) {
        log.error(logheader + ": Problem managedObjectInstance or managedObjectType", ex);
      }
    }

    alarmValueSpecification.setManagedObjectClass(managedObjectType);
    if (log.isDebugEnabled())
      log.debug(logheader + ": _av.setManagedObjectClass set to: " + managedObjectType);

    alarmValueSpecification.setManagedObjectInstance(managedObjectInstance);
    if (log.isDebugEnabled())
      log.debug(logheader + ": _av.setManagedObjectInstance set to: " + managedObjectInstance);

    // set severity and probable cause
    try {
      alarmValueSpecification.setPerceivedSeverity(
          onmsSeverityToOssjSeverity(_openNMSalarm.getSeverity()));

      //			alarmValueSpecification.setProbableCause((short)-1); // OSS/J set to -1  then text
      // contains description
      alarmValueSpecification.setProbableCause((short) _openNMSalarm.getX733ProbableCause());

    } catch (Throwable e) {
      log.error(logheader + ": Problem getting severity or probable cause: ", e);
    }

    if (!isQoSDrxAlarm) { // if is a locally generated alarm

      try {
        String _opinstr = _openNMSalarm.getOperInstruct();
        if (null != _opinstr) {
          matcher = p.matcher(_opinstr);
          _opinstr = matcher.replaceAll(" "); // remove all HTML tags from operator instructions
        } else _opinstr = "NOT_SET";
        alarmValueSpecification.setProposedRepairActions(_opinstr);

        String _logmsg = _openNMSalarm.getLogMsg();
        if (null != _logmsg) {
          matcher = p.matcher(_logmsg);
          _logmsg = matcher.replaceAll(" "); // remove all HTML tags from operator instructions
        } else _logmsg = "NOT_SET";

        String _description = _openNMSalarm.getDescription();
        if (null != _description) {
          matcher = p.matcher(_description);
          _description = matcher.replaceAll(" "); // remove all HTML tags from description
        } else _description = "NOT_SET";

        // using manufacturers own definition of specific problem here ( OSS/J )
        alarmValueSpecification.setSpecificProblem(_logmsg);
        Integer alarmid = _openNMSalarm.getId();
        Integer counter = _openNMSalarm.getCounter();
        String reductionkey = _openNMSalarm.getReductionKey();

        // note some OnmsAlarms can have null nodes - we use a default value of 0 for ID
        Integer nodeid = 0;
        String onmsnodelabel = "";
        if (_openNMSalarm.getNode() != null) {
          nodeid = _openNMSalarm.getNode().getId();
          onmsnodelabel = _openNMSalarm.getNode().getLabel();
        }
        InetAddress ipaddress = _openNMSalarm.getIpAddr();
        String x733AlarmType = _openNMSalarm.getX733AlarmType();
        String x733ProbableCause;
        try {
          x733ProbableCause =
              OOSSProbableCause.getStringforEnum((short) _openNMSalarm.getX733ProbableCause());
        } catch (Throwable e) {
          x733ProbableCause = "X733 Probable Cause Incorrectly Defined";
        }

        alarmValueSpecification.setAdditionalText(
            "<alarmid>"
                + alarmid
                + "</alarmid>"
                + "\n            "
                + "<logmsg>"
                + _logmsg
                + "</logmsg>"
                + "\n            "
                + "<uei>"
                + _uei_no_html
                + "<uei>"
                + "\n            "
                + "<x733AlarmType>"
                + x733AlarmType
                + "</x733AlarmType>"
                + "\n            "
                + "<x733ProbableCause>"
                + x733ProbableCause
                + "</x733ProbableCause>"
                + "\n            "
                + "<counter>"
                + counter
                + "</counter>"
                + "\n            "
                + "<reductionkey>"
                + reductionkey
                + "</reductionkey>"
                + "\n            "
                + "<nodeid>"
                + nodeid
                + "</nodeid>"
                + "\n            "
                + "<nodelabel>"
                + onmsnodelabel
                + "</nodelabel>"
                + "\n            "
                + "<ipaddress>"
                + InetAddressUtils.toIpAddrString(ipaddress)
                + "</ipaddress>"
                + "\n            "
                + "<description>"
                + _description
                + "</description>"
                + "\n            "
                + "<opinstr>"
                + _opinstr
                + "</opinstr>"
                + "\n            "
                + "<asset.managedobjectinstance>"
                + assetManagedObjectInstance
                + "</asset.managedobjectinstance>"
                + "\n            "
                + // TODO - was used for object instance
                "<asset.managedobjecttype>"
                + assetManagedObjectType
                + "</asset.managedobjecttype>"
                + "\n            "
                + "<asset.address2>"
                + assetAddress2
                + "</asset.address2>"
                + "\n            "
                + // TODO - was used for object instance
                "<asset.description>"
                + assetDescription
                + "</asset.description>"
                + "\n"); // TODO - was used for object instancetype

      } catch (Throwable e) {
        log.error(
            logheader + ": Problem setting description, logmessage or operator instrctions: ", e);
      }

    } else { // is a received alarm
      try {
        String _opinstr = _openNMSalarm.getOperInstruct();
        if (null == _opinstr) _opinstr = "NOT_SET";
        alarmValueSpecification.setProposedRepairActions(_opinstr);

        String _logmsg = _openNMSalarm.getLogMsg();
        if (null == _logmsg) _logmsg = "NOT_SET";
        // using manufacturers own definition of specific problem here ( OSS/J )
        alarmValueSpecification.setSpecificProblem(_logmsg);

        String _description = _openNMSalarm.getDescription();
        if (null == _description) _description = "NOT_SET";
        alarmValueSpecification.setAdditionalText(_description);

      } catch (Throwable e) {
        log.error(
            logheader + ": Problem setting description, logmessage or operator instrctions: ", e);
      }
    }

    // TODO replacement method to populate the alarm key
    try {
      // populate alarm key
      // TODO was AlarmKey ak = new OOSSAlarmKey(Integer.toString(_openNMSalarm.getId()));
      AlarmKey ak = alarmValueSpecification.getAlarmKey();
      ak.setAlarmPrimaryKey(Integer.toString(_openNMSalarm.getId()));
      ak.setPrimaryKey(ak.getAlarmPrimaryKey());
    } catch (Throwable e) {
      log.error(logheader + ": Problem setting AlarmKey: ", e);
    }

    if (log.isDebugEnabled()) log.debug(logheader + ": Alarm Populated");

    return alarmValueSpecification;
  } // end populateAlarm()