Skip to content
Permalink
Browse files

feat(api): Initial work

Correlation PoC
Extend OnmsAlarm type with 'impacts' and 'causes'
  • Loading branch information...
smith-opennms authored and j-white committed Apr 17, 2018
1 parent e1083c3 commit fa6250351ad01d6f9cf6ea829b50e00a9f36c5be
Showing with 43 additions and 0 deletions.
  1. +2 −0 src/API.ts
  2. +4 −0 src/dao/AlarmDAO.ts
  3. +7 −0 src/model/OnmsAlarm.ts
  4. +30 −0 src/model/OnmsAlarmSummary.ts
@@ -23,6 +23,7 @@ import {V1FilterProcessor} from './dao/V1FilterProcessor';
import {V2FilterProcessor} from './dao/V2FilterProcessor';

import {OnmsAlarm} from './model/OnmsAlarm';
import {OnmsAlarmSummary} from './model/OnmsAlarmSummary';
import {OnmsAlarmType, AlarmTypes} from './model/OnmsAlarmType';
import {OnmsCategory, Categories} from './model/OnmsCategory';
import {OnmsCollectType, CollectTypes} from './model/OnmsCollectType';
@@ -93,6 +94,7 @@ const DAO = Object.freeze({
/** @hidden */
const Model = Object.freeze({
OnmsAlarm,
OnmsAlarmSummary,
OnmsAlarmType,
OnmsCategory,
Categories,
@@ -11,6 +11,7 @@ import {OnmsResult} from '../api/OnmsResult';
import {SearchProperty} from '../api/SearchProperty';

import {OnmsAlarm} from '../model/OnmsAlarm';
import {OnmsAlarmSummary} from '../model/OnmsAlarmSummary';
import {AlarmTypes} from '../model/OnmsAlarmType';
import {OnmsParm} from '../model/OnmsParm';
import {OnmsServiceType} from '../model/OnmsServiceType';
@@ -392,6 +393,9 @@ export class AlarmDAO extends AbstractDAO<number, OnmsAlarm> {
}
}

alarm.causes = data.causes;
alarm.impacts = data.impacts;

alarm.sticky = this.toMemo(data.stickyMemo);
alarm.journal = this.toMemo(data.reductionKeyMemo);

@@ -2,6 +2,7 @@ import {Moment} from 'moment';

import {IHasUrlValue} from '../api/IHasUrlValue';
import {OnmsAlarmType} from './OnmsAlarmType';
import {OnmsAlarmSummary} from './OnmsAlarmSummary';
import {OnmsEvent} from './OnmsEvent';
import {OnmsParm} from './OnmsParm';
import {OnmsServiceType} from './OnmsServiceType';
@@ -83,6 +84,12 @@ export class OnmsAlarm implements IHasUrlValue {
/** the parameters emitted with this alarm's event */
public parameters: OnmsParm[];

/** impacts - A list of alarms impacted by this alarm */
public impacts: OnmsAlarmSummary[];

/** causes - A list of alarms that cause this alarm */
public causes: OnmsAlarmSummary[];

/** sticky memo - a note associated with this specific alarm instance */
public sticky: OnmsMemo;

@@ -0,0 +1,30 @@
import {Moment} from 'moment';

import {IHasUrlValue} from '../api/IHasUrlValue';
import {OnmsAlarmType} from './OnmsAlarmType';
import {OnmsSeverity} from './OnmsSeverity';

/**
* Represents an OpenNMS alarm.
* @module OnmsAlarm
*/
export class OnmsAlarmSummary implements IHasUrlValue {
/** the alarm ID */
public id: number;

/** the alarm's reduction key */
public reductionKey: string;

/** the alarm's type */
public type: OnmsAlarmType;

/** the alarm's severity */
public severity: OnmsSeverity;

/** the alarm's description */
public description: string;

public get urlValue() {
return String(this.id);
}
}

0 comments on commit fa62503

Please sign in to comment.
You can’t perform that action at this time.