diff options
author | Enbo Wang <wangenbo@huawei.com> | 2020-03-04 00:42:31 +0800 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2020-03-05 10:59:35 +0000 |
commit | 818f76a0173c5d6cef483425042b4f0651ee793b (patch) | |
tree | f5055f9841e51f4b68423d1c6e4bbf5731dbac34 /test/mocks/emssimulator/swm/ems_util.py | |
parent | 5da05c576855c0e9b0f7a3c5934da41b91615f33 (diff) |
EMS simulator extension for PNF SW Upgrade
Change-Id: I3a8c706373f4004850c2403f4aee0d1f28aad464
Issue-ID: INT-1208
Signed-off-by: Enbo Wang <wangenbo@huawei.com>
Diffstat (limited to 'test/mocks/emssimulator/swm/ems_util.py')
-rw-r--r-- | test/mocks/emssimulator/swm/ems_util.py | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/test/mocks/emssimulator/swm/ems_util.py b/test/mocks/emssimulator/swm/ems_util.py index 6d0d3102b..9bfb2cd06 100644 --- a/test/mocks/emssimulator/swm/ems_util.py +++ b/test/mocks/emssimulator/swm/ems_util.py @@ -1,5 +1,22 @@ -#!/usr/bin/python - +# ============LICENSE_START======================================================= +# ONAP - SO +# ================================================================================ +# Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= + +import os import time import json import jsonpath @@ -7,6 +24,18 @@ import jsonpath import conf +def get_log_file(operation): + return os.path.join(conf.LOGGER_FILE_DIR, "%s.txt" % operation) + + +def get_download_dir(om_ip): + return os.path.join(conf.PNF_SIMULATORS_DIR, om_ip, conf.COMMON_PATH, conf.PNF_SW_DOWNLOAD_DIR) + + +def get_install_dir(om_ip): + return os.path.join(conf.PNF_SIMULATORS_DIR, om_ip, conf.COMMON_PATH, conf.PNF_SW_INSTALL_DIR) + + def get_ne_info_list_from_db(ne_filter): with open(conf.NE_INFO_TABLE) as f_ne_info: ne_info_table = json.load(f_ne_info) @@ -47,7 +76,7 @@ def update_ne_info(ne_info): def send_notification(notification, process_id): - notification_file = conf.NOTIFICATION_DIR + '/%s-%d' % (notification['notificationType'], process_id) + notification_file = os.path.join(conf.NOTIFICATION_DIR, '%s-%d' % (notification['notificationType'], process_id)) with open(notification_file, 'w') as f_notification: f_notification.write(json.dumps(notification)) |