From: ebo Date: Wed, 8 Apr 2020 11:32:14 +0000 (+0100) Subject: Update pnf-sw-upgrade module to latest engine v2.8.1 X-Git-Tag: 6.0.0-ONAP~109 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=1402489faba6767edffc4909a2f95a13a2bbd6da;p=integration.git Update pnf-sw-upgrade module to latest engine v2.8.1 - Using loguru to follow new recommend standard - Renamed Yang model filename to comply with https://tools.ietf.org/html/rfc6020#section-5.2 - Renamed initialization data to reflect the target datastore Issue-ID: INT-1516 Signed-off-by: ebo Change-Id: Ifde9e832b6a308dc918e3a84e03bfd43ad0f9b63 --- diff --git a/test/mocks/netconf-pnp-simulator/modules/docker-compose.yml b/test/mocks/netconf-pnp-simulator/modules/docker-compose.yml index e8f2f9ae5..fcfcec403 100644 --- a/test/mocks/netconf-pnp-simulator/modules/docker-compose.yml +++ b/test/mocks/netconf-pnp-simulator/modules/docker-compose.yml @@ -2,7 +2,7 @@ version: '3' services: netconf-pnp-simulator: - image: nexus3.onap.org:10001/onap/integration/simulators/netconf-pnp-simulator:2.6.2 + image: nexus3.onap.org:10001/onap/integration/simulators/netconf-pnp-simulator:2.8.1 container_name: netconf-pnp-simulator restart: always ports: diff --git a/test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/model.yang b/test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/pnf-sw-upgrade.yang similarity index 100% rename from test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/model.yang rename to test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/pnf-sw-upgrade.yang diff --git a/test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/data.xml b/test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/startup.xml similarity index 100% rename from test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/data.xml rename to test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/startup.xml diff --git a/test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/subscriber.py b/test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/subscriber.py index 810fe453e..0786637b0 100755 --- a/test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/subscriber.py +++ b/test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/subscriber.py @@ -27,6 +27,7 @@ from concurrent.futures import ThreadPoolExecutor from threading import Timer import sysrepo as sr +from loguru import logger YANG_MODULE_NAME = 'pnf-sw-upgrade' @@ -117,13 +118,13 @@ def main(): try: print_current_config(sess, YANG_MODULE_NAME) except Exception as e: - print(e) + logger.error(e) sr.global_loop() - print("Application exit requested, exiting.") + logger.info("Application exit requested, exiting.") except Exception as e: - print(e) + logger.error(e) # Function to be called for subscribed client of given session whenever configuration changes. @@ -138,7 +139,7 @@ def module_change_cb(sess, module_name, event, private_ctx): break handle_change(conn, change.oper(), change.old_val(), change.new_val()) except Exception as e: - print(e) + logger.error(e) return sr.SR_ERR_OK @@ -150,10 +151,10 @@ def print_current_config(session, module_name): values = session.get_items(select_xpath) if values is not None: - print("========== BEGIN CONFIG ==========") + logger.info("========== BEGIN CONFIG ==========") for i in range(values.val_cnt()): - print(values.val(i).to_string(), end='') - print("=========== END CONFIG ===========") + logger.info(values.val(i).to_string().strip()) + logger.info("=========== END CONFIG ===========") def handle_change(conn, op, old_val, new_val): @@ -161,7 +162,7 @@ def handle_change(conn, op, old_val, new_val): Handle individual changes on the model. """ if op == sr.SR_OP_CREATED: - print("CREATED: %s" % new_val.to_string()) + logger.info("CREATED: %s" % new_val.to_string()) xpath = new_val.xpath() last_node = xpath_ctx.last_node(xpath) # Warning: 'key_value' modifies 'xpath'! @@ -169,11 +170,11 @@ def handle_change(conn, op, old_val, new_val): if key_id and last_node == 'action': executor.submit(execute_action, conn, key_id, new_val.data().get_enum()) elif op == sr.SR_OP_DELETED: - print("DELETED: %s" % old_val.to_string()) + logger.info("DELETED: %s" % old_val.to_string()) elif op == sr.SR_OP_MODIFIED: - print("MODIFIED: %s to %s" % (old_val.to_string(), new_val.to_string())) + logger.info("MODIFIED: %s to %s" % (old_val.to_string(), new_val.to_string())) elif op == sr.SR_OP_MOVED: - print("MOVED: %s after %s" % (new_val.xpath(), old_val.xpath())) + logger.info("MOVED: %s after %s" % (new_val.xpath(), old_val.xpath())) def execute_action(conn, key_id, action):