diff options
-rw-r--r-- | test/mocks/netconf-pnp-simulator/modules/docker-compose.yml | 2 | ||||
-rw-r--r-- | test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/pnf-sw-upgrade.yang (renamed from test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/model.yang) | 0 | ||||
-rw-r--r-- | test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/startup.xml (renamed from test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/data.xml) | 0 | ||||
-rwxr-xr-x | test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/subscriber.py | 23 |
4 files changed, 13 insertions, 12 deletions
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 index 6d413065e..6d413065e 100644 --- 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 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 index 4f1e7bceb..4f1e7bceb 100644 --- a/test/mocks/netconf-pnp-simulator/modules/pnf-sw-upgrade/data.xml +++ b/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): |