How to use the opennms.Model.OnmsAlarm function in opennms

To help you get started, we’ve selected a few opennms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpenNMS / opennms-helm / src / spec / alarm_entity_spec.js View on Github external
it('should convert many alarms to a valid table', function() {
      let NUM_ALARMS = 500;
      let NUM_UNIQUE_PARM_NAMES = 50;
      let NUM_PARMS_PER_ALARM = 5;
      let alarms = [];
      for (let i = 0; i < NUM_ALARMS; i++) {
        let alarm = new Model.OnmsAlarm();

        // Append a bunch of parameters
        let parms = [];
        for (let j = 0; j < NUM_PARMS_PER_ALARM; j++) {
          parms.push(new Model.OnmsParm(
            ".1.3.6.1.2.1.15.3.1.14.39.252.8." + ((i + j) % NUM_UNIQUE_PARM_NAMES),
            "10.1.1.1",
            "string")
          );
        }
        alarm.lastEvent = new Model.OnmsEvent();
        alarm.lastEvent.parameters = parms;

        alarms.push(alarm);
      }
github OpenNMS / opennms-helm / src / spec / lib_custom_action_spec.js View on Github external
it('should validate a variable with a named event parm', () => {
      const ca = new CustomAction('foo', 'http://bar/$parameters[monkey]');
      const obj = new Model.OnmsAlarm();
      obj.parameters = [
        new Model.OnmsParm('monkey', 'Int32', '6')
      ];
      expect(ca.validate(obj)).to.be.true;
    });
    it('should interpolate a variable with a named event parm', () => {
github OpenNMS / opennms-helm / src / spec / lib_custom_action_spec.js View on Github external
it('should validate a variable with a number index', () => {
      const ca = new CustomAction('foo', 'http://bar/$parameters[0]');
      const alarm = new Model.OnmsAlarm();
      alarm.parameters = [new Model.OnmsParm('blah', 'string', 'yo')];
      expect(ca.validate(alarm)).to.be.true;
    });
    it('should interpolate a variable with a number index', () => {
github OpenNMS / opennms-helm / src / spec / alarm_entity_spec.js View on Github external
it('should convert a single alarm to a valid table', function() {
      let alarm = new Model.OnmsAlarm();
      let table = toTable([alarm]);
      expect(table[0]['rows']).to.have.length(1);
    });
github OpenNMS / opennms-helm / src / spec / lib_custom_action_spec.js View on Github external
it('should interpolate a variable that refers to an object', () => {
      const ca = new CustomAction('foo', 'http://bar/$severity');
      const alarm = new Model.OnmsAlarm();
      alarm.severity = Model.Severities.NORMAL;
      expect(ca.interpolate(alarm)).to.equal('http://bar/NORMAL');
    });
    it('should validate a variable with a number index', () => {
github OpenNMS / opennms-helm / src / spec / lib_custom_action_spec.js View on Github external
it('should validate a variable that refers to an object', () => {
      const ca = new CustomAction('foo', 'http://bar/$severity');
      const alarm = new Model.OnmsAlarm();
      alarm.severity = Model.Severities.NORMAL;
      expect(ca.validate(alarm)).to.be.true;
    });
    it('should interpolate a variable that refers to an object', () => {
github OpenNMS / opennms-helm / src / spec / lib_custom_action_spec.js View on Github external
it('should validate a url with a nodeLabel variable', () => {
      const ca = new CustomAction('foo', 'http://bar/$nodeLabel');
      const alarm = new Model.OnmsAlarm();
      alarm.nodeId = 5;
      alarm.nodeLabel = 'theLabel';
      expect(ca.validate(alarm)).to.be.true;
    });
    it('should interpolate a url with a nodeLabel variable', () => {
github OpenNMS / opennms-helm / src / spec / lib_custom_action_spec.js View on Github external
it('should interpolate a variable with a number index', () => {
      const ca = new CustomAction('foo', 'http://bar/$parameters[0]');
      const alarm = new Model.OnmsAlarm();
      alarm.parameters = [new Model.OnmsParm('blah', 'string', 'yo')];
      expect(ca.interpolate(alarm)).to.equal('http://bar/yo');
    });
    it('should validate a variable with a string index', () => {
github OpenNMS / opennms-helm / src / spec / lib_custom_action_spec.js View on Github external
it('should interpolate a variable with a named event parm', () => {
      const ca = new CustomAction('foo', 'http://bar/$parameters[monkey]');
      const obj = new Model.OnmsAlarm();
      obj.parameters = [
        new Model.OnmsParm('monkey', 'Int32', '6')
      ];
      expect(ca.interpolate(obj)).to.equal('http://bar/6');
    });
  });
github OpenNMS / opennms-helm / src / spec / lib_custom_action_spec.js View on Github external
it('should interpolate a url with a nodeLabel variable', () => {
      const ca = new CustomAction('foo', 'http://bar/$nodeLabel');
      const alarm = new Model.OnmsAlarm();
      alarm.nodeId = 5;
      alarm.nodeLabel = 'theLabel';
      expect(ca.interpolate(alarm)).to.equal('http://bar/theLabel');
    });
    it('should validate a variable that refers to an object', () => {