Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
noc
noc
Commits
14d5cb3f
Verified
Commit
14d5cb3f
authored
Sep 18, 2022
by
Andrey Vertiprahov
Browse files
Raisecom.ROS.get_version. Add parse_kv_version method for parse version output.
parent
12a05900
Pipeline
#37589
passed with stages
in 14 minutes and 29 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
sa/profiles/Raisecom/ROS/get_version.py
View file @
14d5cb3f
...
...
@@ -11,6 +11,7 @@ import re
# NOC modules
from
noc.core.script.base
import
BaseScript
from
noc.sa.interfaces.igetversion
import
IGetVersion
from
noc.core.text
import
parse_kv
class
Script
(
BaseScript
):
...
...
@@ -113,6 +114,29 @@ class Script(BaseScript):
rx_ver_qtech
=
re
.
compile
(
r
"QTECH Universal Software Platform"
)
kv_map
=
{
"product name"
:
"platform"
,
"ros version"
:
"version"
,
"qos version"
:
"version"
,
"bootstrap version"
:
"bootstrap"
,
"boot room version"
:
"bootstrap"
,
"bootrom version"
:
"bootstrap"
,
"hardware version"
:
"hw_rev"
,
"hardware version rev."
:
"hw_rev"
,
"system macaddress is"
:
"mac_address"
,
"system macaddress"
:
"mac_address"
,
"serial number"
:
"serial"
,
}
@
classmethod
def
parse_kv_version
(
cls
,
v
):
r
=
parse_kv
(
cls
.
kv_map
,
v
)
if
not
r
:
raise
NotImplementedError
(
"Not supported platform output format"
)
if
"Gazelle"
in
r
[
"platform"
]:
_
,
r
[
"platform"
]
=
r
[
"platform"
].
split
(
None
,
1
)
return
r
def
parse_version
(
self
,
c
):
r
=
{}
if
"Support ipv6"
in
c
:
...
...
@@ -144,6 +168,8 @@ class Script(BaseScript):
return
r
else
:
match
=
self
.
rx_ver3
.
search
(
c
)
if
not
match
:
return
self
.
parse_kv_version
(
c
)
return
match
.
groupdict
()
# NPK Rotek some Chinese vendor
...
...
sa/profiles/Raisecom/ROS/profile.py
View file @
14d5cb3f
...
...
@@ -42,7 +42,9 @@ class Profile(BaseProfile):
"is_rotek"
:
{
"vendor"
:
{
"$in"
:
[
"Rotek"
,
"ROTEK"
]}},
"is_gazelle"
:
{
"platform"
:
{
"$regex"
:
r
"^[SR]\d+[Ii]\S+"
}},
"is_ifname_use"
:
{
"platform"
:
{
"$regex"
:
"QSW-8200"
}},
"is_version_only_format"
:
{
"version"
:
{
"$regex"
:
r
"^\d+\S+"
}},
# Version format 5.2.1_20171221
"is_version_only_format"
:
{
"version"
:
{
"$regex"
:
r
"^\d+\S+"
}
},
# Version format 5.2.1_20171221
}
rx_date_format
=
re
.
compile
(
r
"(\S+)\s*\((.+)\)"
)
...
...
Andrey Vertiprahov
@aversant
mentioned in commit
223f7de2
·
Sep 18, 2022
mentioned in commit
223f7de2
mentioned in commit 223f7de20ec1db07ffb07951d4b0daf512fa3b02
Toggle commit list
Andrey Vertiprahov
@aversant
mentioned in merge request
!6667 (merged)
·
Sep 18, 2022
mentioned in merge request
!6667 (merged)
mentioned in merge request !6667
Toggle commit list
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