Commit 1e6e7a1f authored by 135's avatar 135
Browse files

ConfDB syslog

Реализация протокола syslog + нормализатор Juniper.JUNOS
parent ba77106e
......@@ -15,6 +15,7 @@ from .udld.base import PROTOCOLS_UDLD_SYNTAX
from .loopdetect.base import PROTOCOLS_LOOP_DETECT_SYNTAX
from .lacp.base import PROTOCOLS_LACP_SYNTAX
from .dns.base import PROTOCOLS_DNS_SYNTAX
from .syslog.base import PROTOCOLS_SYSLOG_SYNTAX
PROTOCOLS_SYNTAX = DEF(
......@@ -28,5 +29,6 @@ PROTOCOLS_SYNTAX = DEF(
PROTOCOLS_LOOP_DETECT_SYNTAX,
PROTOCOLS_LACP_SYNTAX,
PROTOCOLS_DNS_SYNTAX,
PROTOCOLS_SYSLOG_SYNTAX
],
)
# ----------------------------------------------------------------------
# ConfDB protocols syslog syntax
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# NOC modules
from ...defs import DEF
from ...patterns import IP_ADDRESS
PROTOCOLS_SYSLOG_SYNTAX = DEF(
"syslog",
[
DEF(
"syslog-server",
[
DEF(
IP_ADDRESS,
[
DEF(
"source",
[
DEF(
IP_ADDRESS,
name="source_ip",
gen="make_protocols_syslog_server_source",
)
],
),
],
name="ip",
multi=True,
gen="make_protocols_syslog_server",
)
],
),
],
)
......@@ -189,3 +189,11 @@ class JunOSNormalizer(BaseNormalizer):
yield self.make_aaa_service_address_tacacs_secret(
name="tacacs", ip=tokens[2], secret=tokens[-1].strip('"')
)
@match("system", "syslog", "host", IP_ADDRESS)
def normalize_protocols_syslog_server(self, tokens):
yield self.make_protocols_syslog_server(ip=tokens[3])
@match("system", "syslog", "host", IP_ADDRESS, "source-address", IP_ADDRESS)
def normalize_protocols_syslog_server_source(self, tokens):
yield self.make_protocols_syslog_server_source(ip=tokens[3], source_ip=tokens[5])
config: |
system {
syslog {
host 192.0.2.1 {
source-address 198.51.100.1;
}
}
result:
- ['protocols', 'syslog', 'syslog-server', '192.0.2.1']
- ['protocols', 'syslog', 'syslog-server', '192.0.2.1', 'source', '198.51.100.1']
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment