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

fixed tests

This commit is contained in:
Massimo Candela
2023-10-16 13:27:39 +02:00
parent 34f5774db6
commit 5a07f2a013
2 changed files with 13 additions and 4 deletions

View File

@@ -86,11 +86,19 @@ export default class MonitorAS extends Monitor {
const matchedPrefixRule = this.getMoreSpecificMatch(messagePrefix, true);
const groupsUnion = [...new Set([...matchedRule.group, ...matchedPrefixRule.group])];
const differentGroups = this.skipPrefixMatchOnDifferentGroups
&& (groupsUnion.length !== matchedRule.group.length || groupsUnion.length !== matchedPrefixRule.group);
if (matchedPrefixRule) {
const matchedRuleGroup = [matchedRule.group].flat() ?? ["default"];
const matchedPrefixRuleGroup = [matchedPrefixRule.group].flat() ?? ["default"];
if (differentGroups || !matchedPrefixRule) {
if (this.skipPrefixMatchOnDifferentGroups && matchedRuleGroup.some(g => !matchedPrefixRuleGroup.includes(g))) {
this.publishAlert(messageOrigin.getId().toString() + "-" + messagePrefix,
messageOrigin.getId(),
matchedRule,
message,
{});
}
} else {
this.publishAlert(messageOrigin.getId().toString() + "-" + messagePrefix,
messageOrigin.getId(),
matchedRule,

View File

@@ -35,6 +35,7 @@ monitors:
channel: misconfiguration
name: asn-monitor
params:
skipPrefixMatchOnDifferentGroups: false
thresholdMinPeers: 2
- file: monitorRPKI