Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module_name = "ietf-interfaces"
if len(sys.argv) > 1:
module_name = sys.argv[1]
else:
print ("\nYou can pass the module name to be subscribed as the first argument")
# connect to sysrepo
conn = sr.Connection(sr.SR_CONN_DEFAULT)
# start session
sess = sr.Session(conn)
# subscribe for changes in running config */
subscribe = sr.Subscribe(sess)
subscribe.module_change_subscribe(module_name, module_change_cb, None, None, 0, sr.SR_SUBSCR_DONE_ONLY)
print ("\n\n ========== READING RUNNING CONFIG: ==========\n")
try:
print_current_config(sess, module_name)
except Exception as e:
print (e)
sr.global_loop()
subscribe.unsubscribe()
sess.session_stop()
conn=None
print ("Application exit requested, exiting.\n")