Commit fb5d7b53 authored by Lu Xu's avatar Lu Xu 👀

software/ors-amarisoft: add more logs

parent b25f8c60
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = 38bceddc77a5a44d69f0d9614909d1a2 md5sum = 2735363970f6c5569431325c4738896f
[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 = c930c28365c685a6066f382c9b5d8893 ...@@ -28,7 +28,7 @@ md5sum = c930c28365c685a6066f382c9b5d8893
[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
md5sum = 6d6cc0c311ff4fe807e919ce3cb3d0d8 md5sum = b35d43ea8f8add56d7649f2862ddffc5
[lopcomm-rrh-config.jinja2.py] [lopcomm-rrh-config.jinja2.py]
_update_hash_filename_ = lopcomm-rrh-config.jinja2.py _update_hash_filename_ = lopcomm-rrh-config.jinja2.py
...@@ -36,7 +36,7 @@ md5sum = b34fe47a73890097fbc6ea6374aeb38d ...@@ -36,7 +36,7 @@ md5sum = b34fe47a73890097fbc6ea6374aeb38d
[template-enb] [template-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg _update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = 6382f871c0f4e7e965c95de7a959342a md5sum = f372570f16e73f5cc4e638792fd2d5e6
[template-gnb] [template-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg _update_hash_filename_ = instance-gnb.jinja2.cfg
...@@ -64,7 +64,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149 ...@@ -64,7 +64,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149
[enb.jinja2.cfg] [enb.jinja2.cfg]
filename = config/enb.jinja2.cfg filename = config/enb.jinja2.cfg
md5sum = 584a75944dc9aee68fafb1b63e9c1b2b md5sum = 10d5754bbc4d0d0ff665306f3ac9f5bd
[sib23.jinja2.asn] [sib23.jinja2.asn]
filename = config/sib23.jinja2.asn filename = config/sib23.jinja2.asn
...@@ -84,7 +84,7 @@ md5sum = 48b577daa5b53c2cf7fe2d30ea9c0235 ...@@ -84,7 +84,7 @@ md5sum = 48b577daa5b53c2cf7fe2d30ea9c0235
[dnsmasq.jinja2.cfg] [dnsmasq.jinja2.cfg]
filename = config/dnsmasq.jinja2.cfg filename = config/dnsmasq.jinja2.cfg
md5sum = 5f67c7f750e7c7bd9b9839c527a06853 md5sum = dfcd394d1d4b4dd1caa43a9ee7bd6080
[ims.jinja2.cfg] [ims.jinja2.cfg]
filename = config/ims.jinja2.cfg filename = config/ims.jinja2.cfg
...@@ -104,7 +104,7 @@ md5sum = e435990eb0a0d4be41efa9bd16dce09b ...@@ -104,7 +104,7 @@ md5sum = e435990eb0a0d4be41efa9bd16dce09b
[cu_config.jinja2.xml] [cu_config.jinja2.xml]
filename = netconf/cu_config.jinja2.xml filename = netconf/cu_config.jinja2.xml
md5sum = edd54bb35c13526291924de8d1d3b795 md5sum = 2660e02c5afb3e86436282efa9f9fbc4
[software.cfg.html] [software.cfg.html]
_update_hash_filename_ = gadget/software.cfg.html _update_hash_filename_ = gadget/software.cfg.html
......
...@@ -15,13 +15,19 @@ class LopcommNetconfClient: ...@@ -15,13 +15,19 @@ class LopcommNetconfClient:
log_file = "{{ log_file }}" log_file = "{{ log_file }}"
json_log_file = "{{ json_log_file }}" json_log_file = "{{ json_log_file }}"
cfg_json_log_file = "{{ cfg_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.logger = logging.getLogger('logger')
self.json_logger = logging.getLogger('json_logger') self.json_logger = logging.getLogger('json_logger')
self.cfg_json_logger = logging.getLogger('cfg_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.logger.setLevel(logging.DEBUG)
self.json_logger.setLevel(logging.DEBUG) self.json_logger.setLevel(logging.DEBUG)
self.cfg_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_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}') json_formatter = logging.Formatter('{"time": "%(asctime)s", "log_level": "%(levelname)s", "message": "%(message)s", "data": %(data)s}')
...@@ -33,6 +39,16 @@ class LopcommNetconfClient: ...@@ -33,6 +39,16 @@ class LopcommNetconfClient:
cfg_json_handler.setFormatter(cfg_json_formatter) cfg_json_handler.setFormatter(cfg_json_formatter)
self.cfg_json_logger.addHandler(cfg_json_handler) 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) handler = RotatingFileHandler(log_file, maxBytes=100000, backupCount=5)
self.logger.addHandler(handler) self.logger.addHandler(handler)
formatter = logging.Formatter("%(asctime)s [%(levelname)s] %(message)s") formatter = logging.Formatter("%(asctime)s [%(levelname)s] %(message)s")
...@@ -81,6 +97,10 @@ class LopcommNetconfClient: ...@@ -81,6 +97,10 @@ class LopcommNetconfClient:
data_dict = xmltodict.parse(result_in_xml) data_dict = xmltodict.parse(result_in_xml)
if 'alarm-notif' in data_dict['notification']: if 'alarm-notif' in data_dict['notification']:
self.json_logger.info('', extra={'data': data_dict}) 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' in data_dict['notification'] or 'netconf-session-end' in data_dict['notification']:
self.ncsession_json_logger.info('', extra={'data': data_dict})
else: else:
self.cfg_json_logger.info('', extra={'data': data_dict}) 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