Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# 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)
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")
except Exception as e:
print (e)
conn = sr.Connection(sr.SR_CONN_DEFAULT)
# start session
sess = sr.Session(conn)
# subscribe for changes in running config */
subscribe = sr.Subscribe(sess)
print ("\nApplication will provide data of " + module_name + " module\n")
#try:
subscribe.oper_get_items_subscribe(module_name, "/ietf-interfaces:interfaces-state", oper_get_items_cb1)
#except Exception as e:
# print (e)
sr.global_loop()
subscribe.unsubscribe()
sess.session_stop()
conn=None
print ("Application exit requested, exiting.\n")
except Exception as e:
print (e)
# 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")
except Exception as e:
print (e)