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
b8341691
Commit
b8341691
authored
Oct 17, 2023
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6460b542
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
0 deletions
+47
-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/ru/lopcomm/buildout.cfg
software/ors-amarisoft/ru/lopcomm/buildout.cfg
+6
-0
No files found.
software/ors-amarisoft/instance.cfg
View file @
b8341691
...
...
@@ -263,6 +263,8 @@ extra-context =
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_supervision_template ${ru_lopcomm_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 ru_lopcomm_CreateProcessingEle_template ${ru_lopcomm_CreateProcessingEle.jinja2.xml:target}
raw ru_lopcomm_cu_config_template ${ru_lopcomm_cu_config.jinja2.xml:target}
raw ru_lopcomm_firmware_path ${ru_lopcomm_firmware-dl:target}
...
...
software/ors-amarisoft/lopcomm-rrh-reset-info.jinja2.py
0 → 100644
View file @
b8341691
#!{{ 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/ru/lopcomm/buildout.cfg
View file @
b8341691
...
...
@@ -8,6 +8,12 @@ parts +=
[ru_lopcomm_config.jinja2.py]
<= download-base
[ru_lopcomm_reset-info.jinja2.py]
<= download-base
[ru_lopcomm-reset.jinja2.py]
<= download-base
[ru_lopcomm_stats.jinja2.py]
<= 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