mirror of
https://github.com/nttgin/BGPalerter.git
synced 2024-05-19 06:50:08 +00:00
fixed tests
This commit is contained in:
@@ -86,11 +86,19 @@ export default class MonitorAS extends Monitor {
|
|||||||
|
|
||||||
const matchedPrefixRule = this.getMoreSpecificMatch(messagePrefix, true);
|
const matchedPrefixRule = this.getMoreSpecificMatch(messagePrefix, true);
|
||||||
|
|
||||||
const groupsUnion = [...new Set([...matchedRule.group, ...matchedPrefixRule.group])];
|
if (matchedPrefixRule) {
|
||||||
const differentGroups = this.skipPrefixMatchOnDifferentGroups
|
const matchedRuleGroup = [matchedRule.group].flat() ?? ["default"];
|
||||||
&& (groupsUnion.length !== matchedRule.group.length || groupsUnion.length !== matchedPrefixRule.group);
|
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,
|
this.publishAlert(messageOrigin.getId().toString() + "-" + messagePrefix,
|
||||||
messageOrigin.getId(),
|
messageOrigin.getId(),
|
||||||
matchedRule,
|
matchedRule,
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ monitors:
|
|||||||
channel: misconfiguration
|
channel: misconfiguration
|
||||||
name: asn-monitor
|
name: asn-monitor
|
||||||
params:
|
params:
|
||||||
|
skipPrefixMatchOnDifferentGroups: false
|
||||||
thresholdMinPeers: 2
|
thresholdMinPeers: 2
|
||||||
|
|
||||||
- file: monitorRPKI
|
- file: monitorRPKI
|
||||||
|
|||||||
Reference in New Issue
Block a user