diff options
author | Hansen, Tony (th1395) <th1395@att.com> | 2022-08-19 12:56:56 +0000 |
---|---|---|
committer | Hansen, Tony (th1395) <th1395@att.com> | 2022-08-19 12:57:10 +0000 |
commit | dac22d93c804780f2dc20164aeb44fc80a30890d (patch) | |
tree | 7bd19b04ffa5e8fb049068d9de79778eeed140de /miss_htbt_service/db_monitoring.py | |
parent | 554b15356ef100a3617f7f5415f6a35ac2b3ebba (diff) |
lots of cleanup, no functional code changes
Change-Id: I9eefe4d34ae226bbd5a6f80422f89baeeaeb3471
Signed-off-by: Hansen, Tony (th1395) <th1395@att.com>
Issue-ID: DCAEGEN2-2837
Diffstat (limited to 'miss_htbt_service/db_monitoring.py')
-rw-r--r-- | miss_htbt_service/db_monitoring.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/miss_htbt_service/db_monitoring.py b/miss_htbt_service/db_monitoring.py index 32a2d5c..eac8a91 100644 --- a/miss_htbt_service/db_monitoring.py +++ b/miss_htbt_service/db_monitoring.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # ============LICENSE_START======================================================= -# Copyright (c) 2018-2021 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2018-2022 AT&T Intellectual Property. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. # Copyright (c) 2020 Deutsche Telekom. All rights reserved. # Copyright (c) 2021 Fujitsu Ltd. @@ -159,8 +159,8 @@ def db_monitoring(current_pid, json_file, user_name, password, ip_address, port_ while True: time.sleep(20) - envPytest = os.getenv("pytest", "") - if envPytest == "test": + env_pytest = os.getenv("pytest", "") + if env_pytest == "test": break try: @@ -172,14 +172,14 @@ def db_monitoring(current_pid, json_file, user_name, password, ip_address, port_ _logger.error(msg) continue - hbc_pid, hbc_state, hbc_srcName, hbc_time = db.read_hb_common( + hbc_pid, hbc_state, hbc_src_name, hbc_time = db.read_hb_common( user_name, password, ip_address, port_num, db_name ) source_name = socket.gethostname() source_name = source_name + "-" + str(os.getenv("SERVICE_NAME", "")) connection_db = pm.postgres_db_open(user_name, password, ip_address, port_num, db_name) cur = connection_db.cursor() - if int(current_pid) == int(hbc_pid) and source_name == hbc_srcName and hbc_state == "RUNNING": + if int(current_pid) == int(hbc_pid) and source_name == hbc_src_name and hbc_state == "RUNNING": _logger.info("DBM: Active DB Monitoring Instance") cur.execute("SELECT event_name FROM vnf_table_1") vnf_list = [item[0] for item in cur.fetchall()] @@ -222,7 +222,7 @@ def db_monitoring(current_pid, json_file, user_name, password, ip_address, port_ if len(row) == 0: continue epoc_time_sec = row[0][0] - srcName = row[0][1] + src_name = row[0][1] cl_flag = row[0][2] if (epoc_time - epoc_time_sec) > comparision_time and cl_flag == 0: sendControlLoopEvent( @@ -232,7 +232,7 @@ def db_monitoring(current_pid, json_file, user_name, password, ip_address, port_ policy_name, policy_scope, target_type, - srcName, + src_name, epoc_time, closed_control_loop_name, version, @@ -252,7 +252,7 @@ def db_monitoring(current_pid, json_file, user_name, password, ip_address, port_ policy_name, policy_scope, target_type, - srcName, + src_name, epoc_time, closed_control_loop_name, version, @@ -301,6 +301,6 @@ if __name__ == "__main__": _logger.info(msg) while True: db_monitoring(current_pid, jsfile, user_name, password, ip_address, port_num, db_name) - envPytest = os.getenv("pytest", "") - if envPytest == "test": + env_pytest = os.getenv("pytest", "") + if env_pytest == "test": break |