Commit 016d417a authored by Lu Xu's avatar Lu Xu 👀 Committed by Joanne Hugé

software/ors-amarisoft: Update lopcomm config

- activate cu_config_link parameter
- update cu-config.xml
- add supervision log and nc session log
parent fe8fb0cc
......@@ -28,7 +28,7 @@ md5sum = c930c28365c685a6066f382c9b5d8893
[lopcomm-rrh-stats.jinja2.py]
_update_hash_filename_ = lopcomm-rrh-stats.jinja2.py
md5sum = 6d6cc0c311ff4fe807e919ce3cb3d0d8
md5sum = f0451b3c2494f103042bda04433c943d
[lopcomm-rrh-config.jinja2.py]
_update_hash_filename_ = lopcomm-rrh-config.jinja2.py
......@@ -36,7 +36,7 @@ md5sum = b34fe47a73890097fbc6ea6374aeb38d
[template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = 8b6e778ec21e03ef3f832ee420d7e83a
md5sum = 3c3f65517979cae3d46c560daeba886d
[template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg
......@@ -104,7 +104,7 @@ md5sum = e435990eb0a0d4be41efa9bd16dce09b
[cu_config.jinja2.xml]
filename = netconf/cu_config.jinja2.xml
md5sum = edd54bb35c13526291924de8d1d3b795
md5sum = 39ef850c68ea6cb1282176e718819c4a
[software.cfg.html]
_update_hash_filename_ = gadget/software.cfg.html
......
......@@ -104,6 +104,15 @@ version = {{ slapparameter_dict.get("enb_config_version") }}
offline = false
{% endif %}
{% if slapparameter_dict.get("cu_config_link", None) %}
[cu-config-dl]
recipe = slapos.recipe.build:download
url = {{ slapparameter_dict.get("cu_config_link") }}
version = {{ slapparameter_dict.get("cu_config_version") }}
offline = false
{% endif %}
[enb-sh-wrapper]
recipe = slapos.recipe.template
output = ${directory:bin}/${:_buildout_section_name_}
......@@ -252,6 +261,8 @@ extensions = jinja2.ext.do
log-output = ${directory:var}/log/lopcomm-rrh-stats.log
json-log-output = ${directory:var}/log/lopcomm-rrh-stats.json.log
cfg-json-log-output = ${directory:var}/log/lopcomm-rrh-config.json.log
supervision-json-log-output = ${directory:var}/log/lopcomm-rrh-supervision.json.log
ncsession-json-log-output = ${directory:var}/log/lopcomm-rrh-ncsession.json.log
context =
section directory directory
section slap_configuration slap-configuration
......@@ -259,6 +270,8 @@ context =
key log_file :log-output
key json_log_file :json-log-output
key cfg_json_log_file :cfg-json-log-output
key supervision_json_log_file :supervision-json-log-output
key ncsession_json_log_file :ncsession-json-log-output
raw testing {{ slapparameter_dict.get("testing", False) }}
raw python_path {{ buildout_directory}}/bin/pythonwitheggs
import netaddr netaddr
......@@ -268,7 +281,11 @@ output = ${directory:bin}/lopcomm-rrh-stats.py
[lopcomm-cu-config]
<= config-base
{% if slapparameter_dict.get("cu_config_link", None) %}
url = ${enb-config-dl:target}
{% else %}
url = {{ cu_config_template }}
{% endif %}
output = ${directory:etc}/cu_config.xml
[lopcomm-rrh-config-template]
......
......@@ -15,13 +15,19 @@ class LopcommNetconfClient:
log_file = "{{ log_file }}"
json_log_file = "{{ json_log_file }}"
cfg_json_log_file = "{{ cfg_json_log_file }}"
supervision_json_log_file = "{{ supervision_json_log_file }}"
ncsession_json_log_file = "{{ ncsession_json_log_file }}"
self.logger = logging.getLogger('logger')
self.json_logger = logging.getLogger('json_logger')
self.cfg_json_logger = logging.getLogger('cfg_json_logger')
self.supervision_json_logger = logging.getLogger('supervision_json_logger')
self.ncsession_json_logger = logging.getLogger('ncsession_json_logger')
self.logger.setLevel(logging.DEBUG)
self.json_logger.setLevel(logging.DEBUG)
self.cfg_json_logger.setLevel(logging.DEBUG)
self.supervision_json_logger.setLevel(logging.DEBUG)
self.ncsession_json_logger.setLevel(logging.DEBUG)
json_handler = RotatingFileHandler(json_log_file, maxBytes=100000, backupCount=5)
json_formatter = logging.Formatter('{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}')
......@@ -33,6 +39,16 @@ class LopcommNetconfClient:
cfg_json_handler.setFormatter(cfg_json_formatter)
self.cfg_json_logger.addHandler(cfg_json_handler)
supervision_json_handler = RotatingFileHandler(supervision_json_log_file, maxBytes=100000, backupCount=5)
supervision_json_formatter = logging.Formatter('{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}')
supervision_json_handler.setFormatter(supervision_json_formatter)
self.supervision_json_logger.addHandler(supervision_json_handler)
ncsession_json_handler = RotatingFileHandler(ncsession_json_log_file, maxBytes=100000, backupCount=5)
ncsession_json_formatter = logging.Formatter('{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}')
ncsession_json_handler.setFormatter(ncsession_json_formatter)
self.ncsession_json_logger.addHandler(ncsession_json_handler)
handler = RotatingFileHandler(log_file, maxBytes=100000, backupCount=5)
self.logger.addHandler(handler)
formatter = logging.Formatter("%(asctime)s [%(levelname)s] %(message)s")
......@@ -81,6 +97,10 @@ class LopcommNetconfClient:
data_dict = xmltodict.parse(result_in_xml)
if 'alarm-notif' in data_dict['notification']:
self.json_logger.info('', extra={'data': data_dict})
elif 'supervision-notification' in data_dict['notification']:
self.supervision_json_logger.info('', extra={'data': data_dict})
elif 'netconf-session-start' or 'netconf-session-end' in data_dict['notification']:
self.ncsession_json_logger.info('', extra={'data': data_dict})
else:
self.cfg_json_logger.info('', extra={'data': data_dict})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment