Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Andrey Yemelyanov
noc
Commits
934873f3
Commit
934873f3
authored
Jul 12, 2019
by
Andrey Vertiprahov
Browse files
Merge branch 'aversant-release-19.2-patch-06041' into 'release-19.2'
release-19.2:Backport!2340 See merge request
noc/noc!2342
parents
90d866db
60a4e80f
Changes
3
Hide whitespace changes
Inline
Side-by-side
sa/profiles/DCN/DCWL/get_interface_status_ex.py
View file @
934873f3
...
...
@@ -73,8 +73,12 @@ class Script(BaseScript):
continue
ifname
=
value
[
"name"
]
if
value
.
get
(
"bss"
)
and
value
.
get
(
"ssid"
):
ssid
=
value
[
"ssid"
].
replace
(
" "
,
""
).
replace
(
"Managed"
,
""
)
if
ssid
.
startswith
(
"2a2d"
):
# 2a2d - hex string
ssid
=
ssid
.
decode
(
"hex"
)
bss
=
self
.
get_bss_status
(
value
[
"bss"
])
if_ssid
=
"%s.%s"
%
(
ifname
,
value
[
"
ssid
"
]
)
if_ssid
=
"%s.%s"
%
(
ifname
,
ssid
)
r
[
ifname
]
=
{
"interface"
:
ifname
,
"admin_status"
:
bss
[
"admin_status"
],
...
...
sa/profiles/DCN/DCWL/get_interfaces.py
View file @
934873f3
...
...
@@ -79,9 +79,10 @@ class Script(BaseScript):
interfaces
[
ifname
]
=
{
"type"
:
self
.
profile
.
get_interface_type
(
ifname
),
"name"
:
ifname
,
"mac"
:
value
[
"mac"
],
"subinterfaces"
:
[],
}
if
value
[
"mac"
]:
interfaces
[
ifname
][
"mac"
]
=
value
[
"mac"
]
if
"eth"
in
ifname
:
interfaces
[
ifname
][
"subinterfaces"
]
+=
[
{
"name"
:
ifname
,
"mac"
:
value
[
"mac"
],
"enabled_afi"
:
[
"BRIDGE"
]}
...
...
sa/profiles/DCN/DCWL/ping.py
View file @
934873f3
...
...
@@ -8,6 +8,7 @@
# Python modules
import
re
# NOC modules
from
noc.core.script.base
import
BaseScript
from
noc.sa.interfaces.iping
import
IPing
...
...
@@ -19,17 +20,15 @@ class Script(BaseScript):
rx_result
=
re
.
compile
(
r
"^(?P<count>\d+) packets transmitted, (?P<success>\d+) "
r
"(packets received|received),(?:\s|\s\S+ errors, )\d+% packet loss$"
,
re
.
MULTILINE
)
r
"(packets received|received),(?:\s|\s\S+ (errors|duplicates), )\d+% packet loss$"
,
re
.
MULTILINE
,
)
rx_stat
=
re
.
compile
(
r
"^round-trip min/avg/max = (?P<min>.+)/(?P<avg>.+)/(?P<max>.+)\s."
,
re
.
MULTILINE
)
rx_count
=
re
.
compile
(
r
"^\d+ bytes from \d\S+\d+: seq=(\d+) ttl=\d+ time=\S+ ms"
,
re
.
MULTILINE
)
r
"^round-trip min/avg/max = (?P<min>.+)/(?P<avg>.+)/(?P<max>.+)\s."
,
re
.
MULTILINE
)
rx_count
=
re
.
compile
(
r
"^\d+ bytes from \d\S+\d+: seq=(\d+) ttl=\d+ time=\S+ ms"
,
re
.
MULTILINE
)
def
execute
(
self
,
address
,
count
=
None
,
source_address
=
None
,
size
=
None
,
df
=
None
):
def
execute
(
self
,
address
,
count
=
None
,
source_address
=
None
,
size
=
None
,
df
=
None
):
if
count
is
None
:
count
=
5
cmd
=
"ping %s -c %d"
%
(
address
,
int
(
count
))
...
...
@@ -37,15 +36,20 @@ class Script(BaseScript):
cmd
+=
" -s %d"
%
int
(
size
)
if
source_address
:
cmd
+=
" -I %s"
%
source_address
ping
=
self
.
cli
(
cmd
)
result
=
self
.
rx_result
.
search
(
ping
)
result
=
None
try
:
ping
=
self
.
cli
(
cmd
,
ignore_errors
=
True
)
result
=
self
.
rx_result
.
search
(
ping
)
except
self
.
CLISyntaxError
:
pass
"""
Workaround for this incident
PING
10.218.217.227 (10.218.217.227
): 56 data bytes
64 bytes from
10.218.217.227
: seq=0 ttl=61 time=15.436 ms
64 bytes from
10.218.217.227
: seq=1 ttl=61 time=15.265 ms
64 bytes from
10.218.217.227
: seq=2 ttl=61 time=15.365 ms
PING
X.X.X.X (X.X.X.X
): 56 data bytes
64 bytes from
X.X.X.X
: seq=0 ttl=61 time=15.436 ms
64 bytes from
X.X.X.X
: seq=1 ttl=61 time=15.265 ms
64 bytes from
X.X.X.X
: seq=2 ttl=61 time=15.365 ms
ping: sendto: Network is unreachable
Invalid command.
...
...
@@ -54,15 +58,8 @@ class Script(BaseScript):
result
=
self
.
rx_count
.
findall
(
ping
)
return
{
"success"
:
len
(
result
),
"count"
:
count
}
r
=
{
"success"
:
result
.
group
(
"success"
),
"count"
:
result
.
group
(
"count"
),
}
r
=
{
"success"
:
result
.
group
(
"success"
),
"count"
:
result
.
group
(
"count"
)}
stat
=
self
.
rx_stat
.
search
(
ping
)
if
stat
:
r
.
update
({
"min"
:
stat
.
group
(
"min"
),
"avg"
:
stat
.
group
(
"avg"
),
"max"
:
stat
.
group
(
"max"
),
})
r
.
update
({
"min"
:
stat
.
group
(
"min"
),
"avg"
:
stat
.
group
(
"avg"
),
"max"
:
stat
.
group
(
"max"
)})
return
r
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