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
63ca089d
Commit
63ca089d
authored
Sep 05, 2019
by
Andrey Vertiprahov
Browse files
Raisecom.ROS.get_interfaces. Fix getting iface_type.
parent
699b29a1
Pipeline
#15840
failed with stages
in 1 minute and 54 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
sa/profiles/Raisecom/ROS/get_interfaces.py
View file @
63ca089d
...
...
@@ -75,7 +75,7 @@ class Script(BaseScript):
rx_iface_iscom2624g
=
re
.
compile
(
r
"^\s*(?P<ifname>\S+) is (?P<oper_status>UP|DOWN), "
r
"administrative status is (?P<admin_status>UP|DOWN)\s*\n"
r
"(^\s*Description is \"(?P<descr>.+)\"
,
\s*\n)?"
r
"(^\s*Description is \"(?P<descr>.+)\"
?
\s*\n)?"
r
"(^\s*Hardware is (?P<hw_type>\S+), MAC address is (?P<mac>\S+)\s*\n)?"
r
"(^\s*Internet Address is (?P<ip>\S+)\s+primary\s*\n)?"
r
"(^\s*Internet v6 Address is (?P<ipv6>\S+)\s+Link\s*\n)?"
...
...
@@ -123,7 +123,7 @@ class Script(BaseScript):
hw_type
=
"loopback"
i
=
{
"name"
:
ifname
,
"type"
:
self
.
IFTYPES
[
hw_type
]
,
"type"
:
self
.
profile
.
get_interface_type
(
ifname
)
,
"admin_status"
:
match
.
group
(
"admin_status"
)
==
"UP"
,
"oper_status"
:
match
.
group
(
"oper_status"
)
==
"UP"
,
}
...
...
@@ -134,8 +134,8 @@ class Script(BaseScript):
"enabled_afi"
:
[],
}
if
match
.
group
(
"descr"
):
i
[
"description"
]
=
match
.
group
(
"descr"
)
sub
[
"description"
]
=
match
.
group
(
"descr"
)
i
[
"description"
]
=
match
.
group
(
"descr"
)
.
strip
(
"
\"
"
)
sub
[
"description"
]
=
match
.
group
(
"descr"
)
.
strip
(
"
\"
"
)
if
match
.
group
(
"mac"
)
and
match
.
group
(
"mac"
)
!=
"0000.0000.0000"
:
i
[
"mac"
]
=
match
.
group
(
"mac"
)
sub
[
"mac"
]
=
match
.
group
(
"mac"
)
...
...
sa/profiles/Raisecom/ROS/profile.py
View file @
63ca089d
...
...
@@ -182,3 +182,21 @@ class Profile(BaseProfile):
return
match
.
group
(
"port"
)
else
:
return
interface
INTERFACE_TYPES
=
{
"nu"
:
"null"
,
# NULL
"fa"
:
"physical"
,
# fastethernet
"fe"
:
"physical"
,
# fastethernet
"gi"
:
"physical"
,
# gigaethernet
"ge"
:
"physical"
,
# gigaethernet
"lo"
:
"loopback"
,
# Loopback
"tr"
:
"aggregated"
,
#
"mn"
:
"management"
,
# Stack-port
# "te": "physical", # TenGigabitEthernet
"vl"
:
"SVI"
,
# vlan
"un"
:
"unknown"
,
}
@
classmethod
def
get_interface_type
(
cls
,
name
):
return
cls
.
INTERFACE_TYPES
.
get
((
name
[:
2
]).
lower
())
Andrey Vertiprahov
@aversant
mentioned in commit
6a94cf9e
·
Sep 07, 2019
mentioned in commit
6a94cf9e
mentioned in commit 6a94cf9ec0d6b7ac1dddb1d92953931e6de47da7
Toggle commit list
Andrey Vertiprahov
@aversant
mentioned in merge request
!2592 (merged)
·
Sep 07, 2019
mentioned in merge request
!2592 (merged)
mentioned in merge request !2592
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