Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
135
noc
Commits
ed360f78
Commit
ed360f78
authored
Aug 22, 2020
by
Andrey Vertiprahov
Browse files
Merge branch 'confdb-raisecom-rcios' into 'master'
ConfDB normalizer Raisecom.RCIOS + tests. See merge request
noc/noc!4206
parents
fab70d7c
e9ba93e1
Changes
4
Hide whitespace changes
Inline
Side-by-side
sa/profiles/Raisecom/RCIOS/confdb/__init__.py
0 → 100644
View file @
ed360f78
sa/profiles/Raisecom/RCIOS/confdb/normalizer.py
0 → 100644
View file @
ed360f78
# ----------------------------------------------------------------------
# Eltex.MES config normalizer
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# NOC modules
from
noc.core.confdb.normalizer.base
import
BaseNormalizer
,
match
,
ANY
from
noc.core.confdb.syntax.patterns
import
IP_ADDRESS
,
INTEGER
class
RCIOSNormalizer
(
BaseNormalizer
):
@
match
(
"hostname"
,
ANY
)
def
normalize_hostname
(
self
,
tokens
):
yield
self
.
make_hostname
(
tokens
[
1
])
@
match
(
"user"
,
ANY
,
ANY
,
"local"
,
"secret"
,
ANY
,
"authorized-table"
,
ANY
,
ANY
)
def
normalize_username_access_level
(
self
,
tokens
):
yield
self
.
make_user_encrypted_password
(
username
=
tokens
[
2
],
password
=
" "
.
join
(
tokens
[
5
]))
yield
self
.
make_user_class
(
username
=
tokens
[
2
])
@
match
(
"interface"
,
ANY
)
def
normalize_interface
(
self
,
tokens
):
if_name
=
self
.
interface_name
(
tokens
[
1
])
yield
self
.
make_interface
(
interface
=
if_name
)
@
match
(
"interface"
,
ANY
,
"aliasname"
,
ANY
)
def
normalize_interface_description
(
self
,
tokens
):
yield
self
.
make_interface_description
(
interface
=
self
.
interface_name
(
tokens
[
1
]),
description
=
tokens
[
3
]
)
@
match
(
"interface"
,
ANY
,
"switchport"
,
"trunk"
,
"permit"
,
"vlan"
,
ANY
)
def
normalize_switchport_tagged
(
self
,
tokens
):
if_name
=
self
.
interface_name
(
tokens
[
1
])
yield
self
.
make_switchport_tagged
(
interface
=
if_name
,
unit
=
if_name
,
vlan_filter
=
tokens
[
-
1
])
@
match
(
"interface"
,
ANY
,
"ip"
,
"address"
,
ANY
)
def
normalize_vlan_ip
(
self
,
tokens
):
if_name
=
self
.
interface_name
(
tokens
[
1
])
yield
self
.
make_unit_inet_address
(
interface
=
if_name
,
unit
=
if_name
,
address
=
tokens
[
4
])
@
match
(
"interface"
,
ANY
,
"mtu"
,
INTEGER
)
def
normalize_interfce_mtu
(
self
,
tokens
):
if_name
=
self
.
interface_name
(
tokens
[
1
])
yield
self
.
make_interface_mtu
(
interface
=
if_name
,
mtu
=
tokens
[
3
])
@
match
(
"ip"
,
"route"
,
ANY
,
IP_ADDRESS
)
def
normalize_default_gateway
(
self
,
tokens
):
yield
self
.
make_inet_static_route_next_hop
(
route
=
tokens
[
2
],
next_hop
=
tokens
[
3
])
sa/profiles/Raisecom/RCIOS/profile.py
View file @
ed360f78
...
...
@@ -2,7 +2,7 @@
# Vendor: Raisecom
# OS: RCIOS
# ----------------------------------------------------------------------
# Copyright (C) 2007-20
18
The NOC Project
# Copyright (C) 2007-20
20
The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
...
...
@@ -22,6 +22,12 @@ class Profile(BaseProfile):
pattern_syntax_error
=
r
"% \".+\" (?:Unknown command.)"
pattern_more
=
[(
r
"^--More-- \(\d+% of \d+ bytes\)"
,
"r"
)]
config_tokenizer
=
"indent"
config_tokenizer_settings
=
{
"line_comment"
:
"!"
,
}
config_normalizer
=
"RCIOSNormalizer"
INTERFACE_TYPES
=
{
"3g"
:
"tunnel"
,
"du"
:
"other"
,
...
...
tests/confdb/profiles/Raisecom/RCIOS/hostname1.yml
0 → 100644
View file @
ed360f78
config
:
|
hostname host_name
result
:
-
[
"
system"
,
"
hostname"
,
"
host_name"
,
{
"
replace"
:
True
}]
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment