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
Nirina Malard
slapos
Commits
0068fd03
Commit
0068fd03
authored
Aug 16, 2023
by
Lu Xu
👀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
12c29729
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
19 deletions
+49
-19
software/ors-amarisoft/buildout.hash.cfg
software/ors-amarisoft/buildout.hash.cfg
+1
-1
software/ors-amarisoft/lopcomm-rrh-software.jinja2.py
software/ors-amarisoft/lopcomm-rrh-software.jinja2.py
+48
-18
No files found.
software/ors-amarisoft/buildout.hash.cfg
View file @
0068fd03
...
...
@@ -36,7 +36,7 @@ md5sum = b34fe47a73890097fbc6ea6374aeb38d
[lopcomm-rrh-software.jinja2.py]
_update_hash_filename_ = lopcomm-rrh-software.jinja2.py
md5sum =
57f4439524d464961dd8cbd6e5e52fc6
md5sum =
65877f831d497d5bcdc40d4e98c32dc4
[template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
...
...
software/ors-amarisoft/lopcomm-rrh-software.jinja2.py
View file @
0068fd03
...
...
@@ -47,20 +47,29 @@ class LopcommNetconfClient:
hostkey_verify
=
False
)
self
.
logger
.
info
(
'Connection to %s successful'
%
(
self
.
address
,))
def
rpc_request
(
self
,
rpc_files
):
for
rpc_file
in
rpc_files
:
with
open
(
rpc_file
)
as
f
:
rpc_xml
=
f
.
read
()
try
:
self
.
logger
.
info
(
'Sending software management RPC request...'
)
rpc_obj
=
RPC
(
rpc_xml
,
self
.
conn
)
rpc_obj
.
send
()
self
.
logger
.
info
(
'Software management RPC request sent successfully'
)
except
RPCError
as
e
:
self
.
logger
.
error
(
'Error sending software management RPC request: %s'
%
e
)
def
custom_rpc_request
(
self
,
rpc_xml
):
try
:
self
.
logger
.
info
(
'Sending custom RPC request...'
)
response
=
self
.
conn
.
dispatch
(
rpc_xml
)
if
response
.
ok
:
self
.
logger
.
info
(
'Custom RPC request sent successfully'
)
else
:
self
.
logger
.
error
(
'Error sending custom RPC request: %s'
%
response
.
error
)
except
RPCError
as
e
:
self
.
logger
.
error
(
'Error sending custom RPC request: %s'
%
e
)
# def rpc_request(self, rpc_files):
# for rpc_file in rpc_files:
# with open(rpc_file) as f:
# rpc_xml = f.read()
#
# try:
# self.logger.info('Sending software management RPC request...')
# rpc_obj = RPC(rpc_xml, self.conn)
# rpc_obj.send()
# self.logger.info('Software management RPC request sent successfully')
# except RPCError as e:
# self.logger.error('Error sending software management RPC request: %s' % e)
#
# def rpc_request(self, rpc_files):
# for rpc_file in rpc_files:
# with open(rpc_file) as f:
...
...
@@ -77,17 +86,38 @@ class LopcommNetconfClient:
# Close not compatible between ncclient and netconf server
#self.conn.close()
pass
if
__name__
==
'__main__'
:
nc
=
LopcommNetconfClient
()
while
True
:
try
:
nc
.
connect
(
"{{ netaddr.IPAddress(slap_configuration.get('tap-ipv6-gateway', '')) }}"
,
830
,
"oranuser"
,
"oranpassword"
)
nc
.
rpc_request
([
"{{ software_install_template }}"
])
#nc.connect("{{ netaddr.IPAddress(slap_configuration.get('tap-ipv6-gateway', '')) }}", 830, "oranuser", "oranpassword")
nc
.
connect
(
"fe80::20a:ff:fe00:1020%slaptap6"
,
830
,
"oranuser"
,
"oranpassword"
)
# Load your custom RPC XML from a file or construct it manually
custom_rpc_xml
=
"""
<software-install xmlns="urn:o-ran:software-management:1.0">
<slot-name>slot-2</slot-name>
<file-names>PR.PRM61C70V1002.K010927.tar.g</file-names>
</software-install>
"""
nc
.
custom_rpc_request
(
custom_rpc_xml
)
break
except
Exception
as
e
:
nc
.
logger
.
debug
(
'Got exception, waiting 10 seconds before reconnecting...'
)
nc
.
logger
.
debug
(
e
)
nc
.
logger
.
debug
(
str
(
e
)
)
time
.
sleep
(
10
)
finally
:
nc
.
close
()
#if __name__ == '__main__':
# nc = LopcommNetconfClient()
# while True:
# try:
# nc.connect("{{ netaddr.IPAddress(slap_configuration.get('tap-ipv6-gateway', '')) }}", 830, "oranuser", "oranpassword")
# nc.rpc_request(["{{ software_install_template }}"])
# break
# except Exception as e:
# nc.logger.debug('Got exception, waiting 10 seconds before reconnecting...')
# nc.logger.debug(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