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
Steven Gueguen
slapos
Commits
ef683b47
Commit
ef683b47
authored
Oct 13, 2023
by
Lu Xu
👀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/ors-amarisoft: add reset function for RRH
parent
9a73bee4
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
133 additions
and
16 deletions
+133
-16
software/ors-amarisoft/buildout.hash.cfg
software/ors-amarisoft/buildout.hash.cfg
+11
-3
software/ors-amarisoft/instance-enb-input-schema.json.jinja2
software/ors-amarisoft/instance-enb-input-schema.json.jinja2
+5
-0
software/ors-amarisoft/instance-enb.jinja2.cfg
software/ors-amarisoft/instance-enb.jinja2.cfg
+53
-0
software/ors-amarisoft/instance-fdd-lopcomm-enb-input-schema.json
.../ors-amarisoft/instance-fdd-lopcomm-enb-input-schema.json
+5
-0
software/ors-amarisoft/instance.cfg
software/ors-amarisoft/instance.cfg
+2
-0
software/ors-amarisoft/lopcomm-rrh-reset-info.jinja2.py
software/ors-amarisoft/lopcomm-rrh-reset-info.jinja2.py
+39
-0
software/ors-amarisoft/lopcomm-rrh-reset.jinja2.py
software/ors-amarisoft/lopcomm-rrh-reset.jinja2.py
+10
-12
software/ors-amarisoft/ncclient_common.py
software/ors-amarisoft/ncclient_common.py
+2
-1
software/ors-amarisoft/software-base.cfg
software/ors-amarisoft/software-base.cfg
+6
-0
No files found.
software/ors-amarisoft/buildout.hash.cfg
View file @
ef683b47
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
[template]
[template]
filename = instance.cfg
filename = instance.cfg
md5sum =
bc60058a9407fc481b1a652b2f3b5498
md5sum =
998b5ec0dc8c76736c624af2f96ea94d
[amarisoft-stats.jinja2.py]
[amarisoft-stats.jinja2.py]
_update_hash_filename_ = amarisoft-stats.jinja2.py
_update_hash_filename_ = amarisoft-stats.jinja2.py
...
@@ -28,7 +28,7 @@ md5sum = ab666fdfadbfc7d8a16ace38d295c883
...
@@ -28,7 +28,7 @@ md5sum = ab666fdfadbfc7d8a16ace38d295c883
[ncclient_common]
[ncclient_common]
_update_hash_filename_ = ncclient_common.py
_update_hash_filename_ = ncclient_common.py
md5sum = 6
3316f6a8a6a480e10db7e78cca72f3b
md5sum = 6
f8d0592cc4b0b695cea5a0c25aafc4e
[lopcomm-rrh-stats.jinja2.py]
[lopcomm-rrh-stats.jinja2.py]
_update_hash_filename_ = lopcomm-rrh-stats.jinja2.py
_update_hash_filename_ = lopcomm-rrh-stats.jinja2.py
...
@@ -46,9 +46,17 @@ md5sum = 2cd8515253b75e2ab13cc77399762851
...
@@ -46,9 +46,17 @@ md5sum = 2cd8515253b75e2ab13cc77399762851
_update_hash_filename_ = lopcomm-rrh-supervision.jinja2.py
_update_hash_filename_ = lopcomm-rrh-supervision.jinja2.py
md5sum = 243d9fbf640b8dc8bf63d69b07b8afed
md5sum = 243d9fbf640b8dc8bf63d69b07b8afed
[lopcomm-rrh-reset-info.jinja2.py]
_update_hash_filename_ = lopcomm-rrh-reset-info.jinja2.py
md5sum = e03d7fea24566aa8291f0dc4aaf09c67
[lopcomm-rrh-reset.jinja2.py]
_update_hash_filename_ = lopcomm-rrh-reset.jinja2.py
md5sum = 63472d5dc9bd46923d3941b5189e2ccd
[template-enb]
[template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum =
8a47df7cfefa3876afea38ced2c5005f
md5sum =
0d6843d49d5e141378006add136a554b
[template-gnb]
[template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg
_update_hash_filename_ = instance-gnb.jinja2.cfg
...
...
software/ors-amarisoft/instance-enb-input-schema.json.jinja2
View file @
ef683b47
...
@@ -240,6 +240,11 @@
...
@@ -240,6 +240,11 @@
"textarea": true,
"textarea": true,
"type": "string"
"type": "string"
},
},
"cron_schedule": {
"title": "Cron schedule for RRH reset",
"description": "Refer https://crontab.guru/ to make a reset schedule for RRH, for example, '0 1 * * *' means the RRH will reset every day at 1 am",
"type": "string"
},
{%- endif %}
{%- endif %}
"enb_id": {
"enb_id": {
"title": "eNB ID",
"title": "eNB ID",
...
...
software/ors-amarisoft/instance-enb.jinja2.cfg
View file @
ef683b47
...
@@ -14,6 +14,10 @@ parts =
...
@@ -14,6 +14,10 @@ parts =
lopcomm-firmware-dl
lopcomm-firmware-dl
lopcomm-rrh-stats-service
lopcomm-rrh-stats-service
lopcomm-rrh-supervision-service
lopcomm-rrh-supervision-service
lopcomm-rrh-reset-info-service
{% if slapparameter_dict.get("cron_schedule", None) %}
lopcomm-rrh-reset-cron
{% endif %}
lopcomm-rrh-config-template
lopcomm-rrh-config-template
lopcomm-rrh-software-template
lopcomm-rrh-software-template
netconf-connection-promise
netconf-connection-promise
...
@@ -369,6 +373,45 @@ mode = 0775
...
@@ -369,6 +373,45 @@ mode = 0775
url = {{ lopcomm_rrh_supervision_template }}
url = {{ lopcomm_rrh_supervision_template }}
output = ${directory:bin}/lopcomm-rrh-supervision.py
output = ${directory:bin}/lopcomm-rrh-supervision.py
[lopcomm-rrh-reset-info-template]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
log-output = ${directory:var}/log/lopcomm-rrh-reset-info.log
json-log-output = ${directory:var}/log/lopcomm-rrh-reset-info.json.log
context =
section slap_configuration slap-configuration
key log_file :log-output
key json_log_file :json-log-output
raw stats_period {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
raw testing {{ slapparameter_dict.get("testing", False) }}
raw python_path {{ buildout_directory}}/bin/pythonwitheggs
import netaddr netaddr
mode = 0775
url = {{ lopcomm_rrh_reset_info_template }}
output = ${directory:bin}/lopcomm-rrh-reset-info.py
[lopcomm-rrh-reset-template]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
log-output = ${directory:var}/log/lopcomm-rrh-reset.log
json-log-output = ${directory:var}/log/lopcomm-rrh-reset.json.log
context =
section slap_configuration slap-configuration
key log_file :log-output
raw python_path {{ buildout_directory}}/bin/pythonwitheggs
raw buildout_directory_path {{ buildout_directory }}
import netaddr netaddr
mode = 0775
url = {{ lopcomm_rrh_reset_template }}
output = ${directory:etc}/lopcomm-rrh-reset.py
[lopcomm-rrh-reset-cron]
recipe = slapos.cookbook:cron.d
cron-entries = ${cron:cron-entries}
name = rrh-resest
frequency = {{ slapparameter_dict.get("cron_schedule", "") }}
command = {{ buildout_directory}}/bin/pythonwitheggs ${lopcomm-rrh-reset-template:output}
[netconf-connection-promise]
[netconf-connection-promise]
<= monitor-promise-base
<= monitor-promise-base
promise = check_command_execute
promise = check_command_execute
...
@@ -420,6 +463,14 @@ mode = 0775
...
@@ -420,6 +463,14 @@ mode = 0775
hash-files =
hash-files =
${lopcomm-rrh-supervision-template:output}
${lopcomm-rrh-supervision-template:output}
[lopcomm-rrh-reset-info-service]
recipe = slapos.cookbook:wrapper
command-line = ${lopcomm-rrh-reset-info-template:output}
wrapper-path = ${directory:service}/lopcomm-rrh-reset-info
mode = 0775
hash-files =
${lopcomm-rrh-reset-info-template:output}
[lopcomm-firmware-dl]
[lopcomm-firmware-dl]
recipe = slapos.recipe.build:download
recipe = slapos.recipe.build:download
url = https://lab.nexedi.com/nexedi/ors-utils/raw/master/lopcomm-firmware/${:filename}
url = https://lab.nexedi.com/nexedi/ors-utils/raw/master/lopcomm-firmware/${:filename}
...
@@ -545,6 +596,8 @@ monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
...
@@ -545,6 +596,8 @@ monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
{% if ru == "lopcomm" %}
{% if ru == "lopcomm" %}
ssh-command = ssh ${user-info:pw-name}@${slap-configuration:ipv6-random} -p ${sshd-port:port}
ssh-command = ssh ${user-info:pw-name}@${slap-configuration:ipv6-random} -p ${sshd-port:port}
ssh-url = ssh://${user-info:pw-name}@[${slap-configuration:ipv6-random}]:${sshd-port:port}
ssh-url = ssh://${user-info:pw-name}@[${slap-configuration:ipv6-random}]:${sshd-port:port}
ru-firmware = ${lopcomm-firmware-dl:filename}
ru-ipv6 = ${slap-configuration:tap-ipv6-gateway}
{% endif %}
{% endif %}
[monitor-instance-parameter]
[monitor-instance-parameter]
...
...
software/ors-amarisoft/instance-fdd-lopcomm-enb-input-schema.json
View file @
ef683b47
...
@@ -167,6 +167,11 @@
...
@@ -167,6 +167,11 @@
"textarea"
:
true
,
"textarea"
:
true
,
"type"
:
"string"
"type"
:
"string"
},
},
"cron_schedule"
:
{
"title"
:
"Cron schedule for RRH reset"
,
"description"
:
"Refer https://crontab.guru/ to make a reset schedule for RRH, for example, '0 1 * * *' means the RRH will reset every day at 1 am"
,
"type"
:
"string"
},
"enb_id"
:
{
"enb_id"
:
{
"title"
:
"eNB ID"
,
"title"
:
"eNB ID"
,
"description"
:
"eNB ID"
,
"description"
:
"eNB ID"
,
...
...
software/ors-amarisoft/instance.cfg
View file @
ef683b47
...
@@ -258,6 +258,8 @@ extra-context =
...
@@ -258,6 +258,8 @@ extra-context =
raw lopcomm_rrh_config_template ${lopcomm-rrh-config.jinja2.py:target}
raw lopcomm_rrh_config_template ${lopcomm-rrh-config.jinja2.py:target}
raw lopcomm_rrh_software_template ${lopcomm-rrh-software.jinja2.py:target}
raw lopcomm_rrh_software_template ${lopcomm-rrh-software.jinja2.py:target}
raw lopcomm_rrh_supervision_template ${lopcomm-rrh-supervision.jinja2.py:target}
raw lopcomm_rrh_supervision_template ${lopcomm-rrh-supervision.jinja2.py:target}
raw lopcomm_rrh_reset_info_template ${lopcomm-rrh-reset-info.jinja2.py:target}
raw lopcomm_rrh_reset_template ${lopcomm-rrh-reset.jinja2.py:target}
raw CreateProcessingEle_template ${CreateProcessingEle.jinja2.xml:target}
raw CreateProcessingEle_template ${CreateProcessingEle.jinja2.xml:target}
raw cu_config_template ${cu_config.jinja2.xml:target}
raw cu_config_template ${cu_config.jinja2.xml:target}
raw openssl_location ${openssl:location}
raw openssl_location ${openssl:location}
...
...
software/ors-amarisoft/lopcomm-rrh-reset-info.jinja2.py
0 → 100644
View file @
ef683b47
#!{{ python_path }}
import
paramiko
import
logging
from
logging.handlers
import
RotatingFileHandler
def
get_uptime
(
hostname
,
username
,
password
):
client
=
paramiko
.
SSHClient
()
client
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
try
:
client
.
connect
(
hostname
,
username
=
username
,
password
=
password
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
'uptime'
)
uptime_output
=
stdout
.
read
().
decode
()
return
uptime_output
except
Exception
as
e
:
logger
.
info
(
f"Error:
{
e
}
"
)
finally
:
client
.
close
()
# Usage
hostname
=
"{{ netaddr.IPAddress(slap_configuration.get('tap-ipv6-gateway', '')) }}"
username
=
"oranuser"
password
=
"oranpassword"
# Initialize logger
log_file
=
"{{ log_file }}"
logger
=
logging
.
getLogger
(
'logger'
)
logger
.
setLevel
(
logging
.
INFO
)
handler
=
RotatingFileHandler
(
log_file
,
maxBytes
=
30000
,
backupCount
=
2
)
formatter
=
logging
.
Formatter
(
'%(asctime)s - %(levelname)s - %(message)s'
)
handler
.
setFormatter
(
formatter
)
logger
.
addHandler
(
handler
)
if
{{
testing
}}:
pass
else
:
rrh_uptime
=
get_uptime
(
hostname
,
username
,
password
)
logger
.
info
(
f"Uptime from RRH:
{
rrh_uptime
}
"
)
software/ors-amarisoft/lopcomm-rrh-reset.jinja2.py
View file @
ef683b47
...
@@ -5,15 +5,13 @@ sys.path.append({{ repr(buildout_directory_path) }})
...
@@ -5,15 +5,13 @@ sys.path.append({{ repr(buildout_directory_path) }})
from
ncclient_common
import
LopcommNetconfClient
from
ncclient_common
import
LopcommNetconfClient
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
nc
=
LopcommNetconfClient
(
log_file
=
"{{ log_file }}"
)
nc
=
LopcommNetconfClient
(
log_file
=
"{{ log_file }}"
)
while
True
:
try
:
try
:
nc
.
connect
(
"{{ netaddr.IPAddress(slap_configuration.get('tap-ipv6-gateway', '')) }}"
,
830
,
"oranuser"
,
"oranpassword"
)
nc
.
connect
(
"{{ netaddr.IPAddress(slap_configuration.get('tap-ipv6-gateway', '')) }}"
,
830
,
"oranuser"
,
"oranpassword"
)
nc
.
reset_device
()
nc
.
nc
.
reset_device
()
nc
.
logger
.
info
(
"Device reset successful."
)
break
except
Exception
as
e
:
except
Exception
as
e
:
nc
.
logger
.
debug
(
'Got exception while resetting...'
)
nc
.
logger
.
debug
(
'Got exception, waiting 10 seconds before reconnecting...'
)
nc
.
logger
.
debug
(
e
)
nc
.
logger
.
debug
(
e
)
finally
:
time
.
sleep
(
10
)
nc
.
close
()
finally
:
nc
.
close
()
software/ors-amarisoft/ncclient_common.py
View file @
ef683b47
...
@@ -153,7 +153,8 @@ class LopcommNetconfClient:
...
@@ -153,7 +153,8 @@ class LopcommNetconfClient:
reset_reply_xml
=
self
.
custom_rpc_request
(
reset_rpc_xml
)
reset_reply_xml
=
self
.
custom_rpc_request
(
reset_rpc_xml
)
if
reset_reply_xml
:
if
reset_reply_xml
:
reset_data
=
xmltodict
.
parse
(
reset_reply_xml
)
reset_data
=
xmltodict
.
parse
(
reset_reply_xml
)
self
.
software_reply_json_logger
.
info
(
''
,
extra
=
{
'data'
:
json
.
dumps
(
reset_data
)})
if
self
.
software_reply_json_logger
:
self
.
software_reply_json_logger
.
info
(
''
,
extra
=
{
'data'
:
json
.
dumps
(
reset_data
)})
self
.
logger
.
info
(
'Wait 60 second then reboot!'
)
self
.
logger
.
info
(
'Wait 60 second then reboot!'
)
time
.
sleep
(
60
)
time
.
sleep
(
60
)
...
...
software/ors-amarisoft/software-base.cfg
View file @
ef683b47
...
@@ -80,6 +80,12 @@ destination = ${buildout:directory}/ncclient_common.py
...
@@ -80,6 +80,12 @@ destination = ${buildout:directory}/ncclient_common.py
[lopcomm-rrh-supervision.jinja2.py]
[lopcomm-rrh-supervision.jinja2.py]
<= download-base
<= download-base
[lopcomm-rrh-reset-info.jinja2.py]
<= download-base
[lopcomm-rrh-reset.jinja2.py]
<= download-base
[template-enb]
[template-enb]
<= download-base
<= download-base
...
...
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