Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(alarms): HZN-1492 : Add RootCause and Tags to SituationFeedback (#…
…35) * feat(alarms): HZN-1492: Add Root Cause to Situation Feedback * feat(alarms): HZN-1492: rootCause and tags * feat(alarms): HZN-1492: rootCause and tags * feat(alarms): HZN-1492: test typo * feat(alarms): HZN-1492: New Feedback Type
- Loading branch information
1 parent
727eb0f
commit 3790072
Showing
8 changed files
with
275 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
[ | ||
{ | ||
"situationKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:SITUATION", | ||
"situationFingerprint": "NDg3ZjdiMjJmNjgzMTJkMmMxYmJjOTNiMWFlYTQ0NWI=", | ||
"alarmKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:ALARM_C", | ||
"feedbackType": "CORRECT", | ||
"rootCause": false, | ||
"reason": null, | ||
"tags": [ | ||
"banana", | ||
"red", | ||
"blue", | ||
"green", | ||
"basketball", | ||
"baseball", | ||
"ball", | ||
"ball" | ||
], | ||
"user": "admin", | ||
"timestamp": 1553886888758 | ||
}, | ||
{ | ||
"situationKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:SITUATION", | ||
"situationFingerprint": "NDg3ZjdiMjJmNjgzMTJkMmMxYmJjOTNiMWFlYTQ0NWI=", | ||
"alarmKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:ALARM_A", | ||
"feedbackType": "FALSE_POSITIVE", | ||
"rootCause": false, | ||
"reason": null, | ||
"tags": [ | ||
"banana", | ||
"red", | ||
"blue", | ||
"green", | ||
"basketball", | ||
"baseball", | ||
"ball", | ||
"ball" | ||
], | ||
"user": "admin", | ||
"timestamp": 1553886888758 | ||
}, | ||
{ | ||
"situationKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:SITUATION", | ||
"situationFingerprint": "NDg3ZjdiMjJmNjgzMTJkMmMxYmJjOTNiMWFlYTQ0NWI=", | ||
"alarmKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:ALARM_A", | ||
"feedbackType": "CORRECT", | ||
"rootCause": true, | ||
"reason": "ALL_CORRECT", | ||
"tags": [], | ||
"user": "admin", | ||
"timestamp": 1553886650607 | ||
}, | ||
{ | ||
"situationKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:SITUATION", | ||
"situationFingerprint": "NDg3ZjdiMjJmNjgzMTJkMmMxYmJjOTNiMWFlYTQ0NWI=", | ||
"alarmKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:ALARM_C", | ||
"feedbackType": "CORRECT", | ||
"rootCause": false, | ||
"reason": "ALL_CORRECT", | ||
"tags": [], | ||
"user": "admin", | ||
"timestamp": 1553886650608 | ||
}, | ||
{ | ||
"situationKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:SITUATION", | ||
"situationFingerprint": "NDg3ZjdiMjJmNjgzMTJkMmMxYmJjOTNiMWFlYTQ0NWI=", | ||
"alarmKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:ALARM_C", | ||
"feedbackType": "CORRECT", | ||
"rootCause": false, | ||
"reason": "ALL_CORRECT", | ||
"tags": [], | ||
"user": "admin", | ||
"timestamp": 1553886739828 | ||
}, | ||
{ | ||
"situationKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:SITUATION", | ||
"situationFingerprint": "NDg3ZjdiMjJmNjgzMTJkMmMxYmJjOTNiMWFlYTQ0NWI=", | ||
"alarmKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:ALARM_B", | ||
"feedbackType": "FALSE_POSITIVE", | ||
"rootCause": false, | ||
"reason": "ALL_CORRECT", | ||
"tags": [], | ||
"user": "admin", | ||
"timestamp": 1553886650608 | ||
}, | ||
{ | ||
"situationKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:SITUATION", | ||
"situationFingerprint": "NDg3ZjdiMjJmNjgzMTJkMmMxYmJjOTNiMWFlYTQ0NWI=", | ||
"alarmKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:ALARM_A", | ||
"feedbackType": "FALSE_POSITIVE", | ||
"rootCause": false, | ||
"reason": "ALL_CORRECT", | ||
"tags": [], | ||
"user": "admin", | ||
"timestamp": 1553886739827 | ||
}, | ||
{ | ||
"situationKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:SITUATION", | ||
"situationFingerprint": "NDg3ZjdiMjJmNjgzMTJkMmMxYmJjOTNiMWFlYTQ0NWI=", | ||
"alarmKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:ALARM_B", | ||
"feedbackType": "CORRECT", | ||
"rootCause": true, | ||
"reason": "ALL_CORRECT", | ||
"tags": [], | ||
"user": "admin", | ||
"timestamp": 1553886739827 | ||
}, | ||
{ | ||
"situationKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:SITUATION", | ||
"situationFingerprint": "NDg3ZjdiMjJmNjgzMTJkMmMxYmJjOTNiMWFlYTQ0NWI=", | ||
"alarmKey": "uei.opennms.org/alarms/trigger:localhost:0.0.0.0:ALARM_B", | ||
"feedbackType": "CORRECT", | ||
"rootCause": true, | ||
"reason": null, | ||
"tags": [ | ||
"banana", | ||
"red", | ||
"blue", | ||
"green", | ||
"basketball", | ||
"baseball", | ||
"ball", | ||
"ball" | ||
], | ||
"user": "admin", | ||
"timestamp": 1553886888758 | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["ball","banana","baseball","basketball"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** @hidden */ | ||
declare const Promise, require; | ||
|
||
/** @hidden */ | ||
// tslint:disable-next-line | ||
const URI = require('urijs'); | ||
|
||
import {AbstractHTTP} from '../../src/rest/AbstractHTTP'; | ||
|
||
import {OnmsHTTPOptions} from '../../src/api/OnmsHTTPOptions'; | ||
import {OnmsResult} from '../../src/api/OnmsResult'; | ||
|
||
export class MockHTTP24 extends AbstractHTTP { | ||
/** make an HTTP get call -- this should be overridden by the implementation */ | ||
public get(url: string, options?: OnmsHTTPOptions): Promise<OnmsResult<any>> { | ||
const urlObj = new URI(url); | ||
if (options && options.parameters) { | ||
urlObj.search(options.parameters); | ||
} | ||
|
||
switch (urlObj.toString()) { | ||
case 'http://demo.opennms.org/opennms/rest/info': { | ||
return Promise.resolve( | ||
OnmsResult.ok({displayVersion: '24.0.0', packageDescription: 'OpenNMS', | ||
packageName: 'opennms', version: '24.0.0'})); | ||
} | ||
case 'rest/situation-feedback/616': { | ||
const result = OnmsResult.ok(require('./24.0.0/get/rest/situation-feedback/616.json')); | ||
result.type = 'application/json'; | ||
return Promise.resolve(result); | ||
} | ||
case 'rest/situation-feedback/tags': { | ||
const result = OnmsResult.ok(require('./24.0.0/get/rest/situation-feedback/tags.json')); | ||
result.type = 'application/json'; | ||
return Promise.resolve(result); | ||
} | ||
} | ||
throw new Error('Not yet implemented: GET ' + urlObj.toString()); | ||
} | ||
|
||
public put(url: string, options?: OnmsHTTPOptions): Promise<OnmsResult<any>> { | ||
const urlObj = new URI(url); | ||
throw new Error('Not yet implemented: PUT ' + urlObj.toString()); | ||
} | ||
|
||
public post(url: string, options?: OnmsHTTPOptions): Promise<OnmsResult<any>> { | ||
const urlObj = new URI(url); | ||
throw new Error('Not yet implemented: POST ' + urlObj.toString()); | ||
} | ||
|
||
public httpDelete(url: string, options?: OnmsHTTPOptions): Promise<OnmsResult<any>> { | ||
const urlObj = new URI(url); | ||
throw new Error('Not yet implemented: DELETE ' + urlObj.toString()); | ||
} | ||
} |