Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
105
Merge Requests
105
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
5f9b949c
Commit
5f9b949c
authored
Dec 05, 2023
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b3a07944
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
66 deletions
+4
-66
software/ors-amarisoft/ru/lopcomm/libinstance.jinja2.cfg
software/ors-amarisoft/ru/lopcomm/libinstance.jinja2.cfg
+4
-3
software/ors-amarisoft/ru/lopcomm/supervision.jinja2.py
software/ors-amarisoft/ru/lopcomm/supervision.jinja2.py
+0
-63
No files found.
software/ors-amarisoft/ru/lopcomm/libinstance.jinja2.cfg
View file @
5f9b949c
...
...
@@ -17,9 +17,6 @@ promise = check_socket_listening
config-host = ${vtap.{{ru.cpri_link._tap}}:gateway}
config-port = 830
{{ promise('%s-netconf-connection' % ru_ref) }}
promise = check_command_execute
config-command = [ -f ${ {{-ru_ref}}-supervision-template:is_netconf_connected} ]
{#- push firmware to RU #}
...
...
@@ -142,6 +139,10 @@ mode = 0775
hash-files =
${:command-line}
{{ promise('%s-netconf-connection' % ru_ref) }}
promise = check_command_execute
config-command = [ -f ${ {{-ru_ref}}-supervision-template:is_netconf_connected} ]
{{ promise('%s-vswr' % ru_ref) }}
promise = check_lopcomm_vswr
config-netconf-log = ${ {{- ru_ref}}-stats-template:json-log-output}
...
...
software/ors-amarisoft/ru/lopcomm/supervision.jinja2.py
deleted
100644 → 0
View file @
b3a07944
#!{{ python_path }}
import
time
import
json
import
xmltodict
import
sys
import
re
import
os
sys
.
path
.
append
({{
repr
(
buildout_directory_path
)
}})
from
ncclient_common
import
LopcommNetconfClient
if
__name__
==
'__main__'
:
nc
=
LopcommNetconfClient
(
log_file
=
"{{ log_file }}"
,
supervision_reply_json_log_file
=
"{{ supervision_reply_json_log_file }}"
)
# XXX no while True?
try
:
netconf_check_file
=
'{{ is_netconf_connected }}'
nc
.
connect
(
"{{ netaddr.IPAddress(vtap.gateway) }}"
,
830
,
"oranuser"
,
"oranpassword"
)
supervision_subscription_rpc_xml
=
"""
<create-subscription xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
<stream>o-ran-supervision</stream>
</create-subscription>
"""
nc
.
logger
.
info
(
"Subscription creating..."
)
supervision_subscription_reply_xml
=
nc
.
custom_rpc_request
(
supervision_subscription_rpc_xml
)
if
supervision_subscription_reply_xml
:
nc
.
logger
.
info
(
"Subscription created"
)
supervision_subscription_data
=
xmltodict
.
parse
(
supervision_subscription_reply_xml
)
nc
.
supervision_reply_json_logger
.
info
(
''
,
extra
=
{
'data'
:
json
.
dumps
(
supervision_subscription_data
)})
while
True
:
supervision_watchdog_rpc_xml
=
"""
<supervision-watchdog-reset xmlns="urn:o-ran:supervision:1.0">
<supervision-notification-interval>60</supervision-notification-interval>
<guard-timer-overhead>10</guard-timer-overhead>
</supervision-watchdog-reset>
"""
nc
.
logger
.
info
(
"NETCONF server replying..."
)
supervision_watchdog_reply_xml
=
nc
.
custom_rpc_request
(
supervision_watchdog_rpc_xml
)
if
supervision_watchdog_reply_xml
:
if
not
os
.
path
.
exists
(
netconf_check_file
):
open
(
netconf_check_file
,
"w"
).
write
(
'True'
)
nc
.
logger
.
info
(
"NETCONF server replied"
)
supervision_watchdog_data
=
xmltodict
.
parse
(
supervision_watchdog_reply_xml
)
nc
.
supervision_reply_json_logger
.
info
(
''
,
extra
=
{
'data'
:
json
.
dumps
(
supervision_watchdog_data
)})
# It must be the same interval as <supervision-notification-interval>
time
.
sleep
(
60
)
else
:
if
os
.
path
.
exists
(
netconf_check_file
):
os
.
remove
(
netconf_check_file
)
else
:
nc
.
logger
.
debug
(
"Subscription failed."
)
except
Exception
as
e
:
nc
.
logger
.
debug
(
'Got exception, waiting 10 seconds before reconnecting...'
)
nc
.
logger
.
debug
(
str
(
e
))
time
.
sleep
(
10
)
finally
:
nc
.
close
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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