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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lu Xu
slapos
Commits
76719abd
Commit
76719abd
authored
May 24, 2024
by
Lu Xu
👀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add delay yang model support
parent
3db1ebe5
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
3 deletions
+58
-3
software/ors-amarisoft/buildout.hash.cfg
software/ors-amarisoft/buildout.hash.cfg
+6
-2
software/ors-amarisoft/instance.cfg
software/ors-amarisoft/instance.cfg
+2
-0
software/ors-amarisoft/ru/lopcomm/buildout.cfg
software/ors-amarisoft/ru/lopcomm/buildout.cfg
+3
-0
software/ors-amarisoft/ru/lopcomm/delay.jinja2.py
software/ors-amarisoft/ru/lopcomm/delay.jinja2.py
+36
-0
software/ors-amarisoft/ru/lopcomm/ncclient_common.py
software/ors-amarisoft/ru/lopcomm/ncclient_common.py
+11
-1
No files found.
software/ors-amarisoft/buildout.hash.cfg
View file @
76719abd
...
...
@@ -16,7 +16,7 @@
[template]
filename = instance.cfg
md5sum =
43f02b7b3552d0d657fa7dbf43ce20a5
md5sum =
18f5c6627308068131d0df3489c4b98d
[template-ors]
filename = instance-ors.cfg
...
...
@@ -52,7 +52,11 @@ md5sum = bc5d82b8737b6990674b280ef2774be7
[ru_lopcomm_ncclient_common.py]
_update_hash_filename_ = ru/lopcomm/ncclient_common.py
md5sum = 8dbe6a48fc0fca4f0cbd0c746be1aeda
md5sum = 5cc878f4c596335a1b6d90e1c03b53a5
[ru_lopcomm_delay.jinja2.py]
_update_hash_filename_ = ru/lopcomm/delay.jinja2.py
md5sum = ac284ce07181d3c5d1a5f4fc7cdb2304
[ru_lopcomm_stats.jinja2.py]
_update_hash_filename_ = ru/lopcomm/stats.jinja2.py
...
...
software/ors-amarisoft/instance.cfg
View file @
76719abd
...
...
@@ -161,6 +161,7 @@ extra-context =
raw ru_lopcomm_stats_template ${ru_lopcomm_stats.jinja2.py:target}
raw ru_lopcomm_config_template ${ru_lopcomm_config.jinja2.py:target}
raw ru_lopcomm_software_template ${ru_lopcomm_software.jinja2.py:target}
raw ru_lopcomm_delay_template ${ru_lopcomm_delay.jinja2.py:target}
raw ru_lopcomm_reset_info_template ${ru_lopcomm_reset-info.jinja2.py:target}
raw ru_lopcomm_reset_template ${ru_lopcomm_reset.jinja2.py:target}
raw ru_lopcomm_CreateProcessingEle_template ${ru_lopcomm_CreateProcessingEle.jinja2.xml:target}
...
...
@@ -217,6 +218,7 @@ extra-context =
raw ru_lopcomm_stats_template ${ru_lopcomm_stats.jinja2.py:target}
raw ru_lopcomm_config_template ${ru_lopcomm_config.jinja2.py:target}
raw ru_lopcomm_software_template ${ru_lopcomm_software.jinja2.py:target}
raw ru_lopcomm_delay_template ${ru_lopcomm_delay.jinja2.py:target}
raw ru_lopcomm_reset_info_template ${ru_lopcomm_reset-info.jinja2.py:target}
raw ru_lopcomm_reset_template ${ru_lopcomm_reset.jinja2.py:target}
raw ru_lopcomm_CreateProcessingEle_template ${ru_lopcomm_CreateProcessingEle.jinja2.xml:target}
...
...
software/ors-amarisoft/ru/lopcomm/buildout.cfg
View file @
76719abd
...
...
@@ -7,6 +7,9 @@ parts +=
[ru_lopcomm_libinstance.jinja2.cfg]
<= download-base
[ru_lopcomm_delay.jinja2.py]
<= download-base
[ru_lopcomm_config.jinja2.py]
<= download-base
...
...
software/ors-amarisoft/ru/lopcomm/delay.jinja2.py
0 → 100644
View file @
76719abd
#!{{ 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 }}"
,
delay_reply_json_log_file
=
"{{ delay_reply_json_log_file }}"
)
while
True
:
try
:
delay_rpc_xml
=
f"""
<get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<filter type="xpath" xmlns:o-ran-delay-ru-cpri="urn:o-ran:delay-ru-cpri:1.0" select="/o-ran-delay-ru-cpri:ru-delay-profile" />
</get>
"""
delay_reply_xml
=
nc
.
custom_rpc_request
(
delay_rpc_xml
)
nc
.
logger
.
info
(
"Getting delay parameters..."
)
time
.
sleep
(
60
)
if
delay_reply_xml
:
nc
.
logger
.
info
(
"Got delay parameter."
)
delay_data
=
xmltodict
.
parse
(
delay_reply_xml
)
nc
.
delay_reply_json_logger
.
info
(
''
,
extra
=
{
'data'
:
json
.
dumps
(
delay_data
)})
break
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
()
software/ors-amarisoft/ru/lopcomm/ncclient_common.py
View file @
76719abd
...
...
@@ -10,7 +10,7 @@ from ncclient.devices.default import DefaultDeviceHandler
class
LopcommNetconfClient
:
def
__init__
(
self
,
log_file
,
json_log_file
=
None
,
cfg_json_log_file
=
None
,
supervision_json_log_file
=
None
,
ncsession_json_log_file
=
None
,
software_json_log_file
=
None
,
software_reply_json_log_file
=
None
,
supervision_reply_json_log_file
=
None
,
testing
=
False
):
def
__init__
(
self
,
log_file
,
json_log_file
=
None
,
cfg_json_log_file
=
None
,
supervision_json_log_file
=
None
,
ncsession_json_log_file
=
None
,
software_json_log_file
=
None
,
software_reply_json_log_file
=
None
,
supervision_reply_json_log_file
=
None
,
delay_reply_json_log_file
=
None
,
testing
=
False
):
self
.
logger
=
logging
.
getLogger
(
'logger'
)
self
.
logger
.
setLevel
(
logging
.
DEBUG
)
...
...
@@ -82,6 +82,16 @@ class LopcommNetconfClient:
else
:
self
.
software_reply_json_logger
=
None
if
delay_reply_json_log_file
:
self
.
delay_reply_json_logger
=
logging
.
getLogger
(
'delay_reply_json_logger'
)
self
.
delay_reply_json_logger
.
setLevel
(
logging
.
DEBUG
)
delay_reply_json_handler
=
RotatingFileHandler
(
delay_reply_json_log_file
,
maxBytes
=
100000
,
backupCount
=
5
)
delay_reply_json_formatter
=
logging
.
Formatter
(
'{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}'
)
delay_reply_json_handler
.
setFormatter
(
delay_reply_json_formatter
)
self
.
delay_reply_json_logger
.
addHandler
(
delay_reply_json_handler
)
else
:
self
.
delay_reply_json_logger
=
None
if
testing
:
return
...
...
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