1
0
mirror of https://github.com/nttgin/BGPalerter.git synced 2024-05-19 06:50:08 +00:00

fixed TA monitoring and added test

This commit is contained in:
Massimo Candela
2021-06-07 02:30:14 +02:00
parent 8854673dce
commit 24da6459d0
4 changed files with 16 additions and 3 deletions

View File

@@ -55,7 +55,7 @@ export default class MonitorROAS extends Monitor {
for (let ta in sizes) {
if (this.timesDeletedTAs[ta]) {
const min = Math.min(this.timesDeletedTAs[ta], sizes[ta]);
const max = Math.min(this.timesDeletedTAs[ta], sizes[ta]);
const max = Math.max(this.timesDeletedTAs[ta], sizes[ta]);
const diff = max - min;
const percentage = 100 / max * diff;

View File

@@ -93,7 +93,7 @@ export default class MonitorRPKI extends Monitor {
const coveringString = (covering) ? `Valid ROAs: ${covering}`: '';
if (extra.roaDisappeared && this.params.checkDisappearing) {
return `The route ${message.prefix} announced by ${message.originAS} is no longer covered by a ROA.`;
return `The route ${message.prefix} announced by ${message.originAS} is no longer covered by a ROA`;
} else if (extra.valid === null && this.params.checkUncovered) {
return `The route ${message.prefix} announced by ${message.originAS} is not covered by a ROA`;
} else if (extra.valid === false) {

View File

@@ -53,7 +53,7 @@ describe("RPKI monitoring external", function() {
id: 'a82_112_100_0_24-2914-null',
origin: 'rpki-monitor',
affected: '82.112.100.0/24',
message: 'The route 82.112.100.0/24 announced by AS2914 is no longer covered by a ROA.'
message: 'The route 82.112.100.0/24 announced by AS2914 is no longer covered by a ROA'
}
};

View File

@@ -56,6 +56,19 @@ describe("RPKI monitoring external", function() {
it("ROA diff and expiration - external connector", function (done) {
const expectedData = {
"disappeared-ripe": {
id: 'disappeared-ripe',
truncated: false,
origin: 'rpki-monitor',
affected: 'ripe',
message: 'Possible TA malfunction: 60.00% of the ROAs disappeared from ripe',
data: [
{
affected: 'ripe',
matchedMessage: 'Possible TA malfunction: 60.00% of the ROAs disappeared from ripe'
}
]
},
"28c7aa78b6286e0e3c6583797f7df47c": {
id: '28c7aa78b6286e0e3c6583797f7df47c',
truncated: false,