How to use the sysrepo.global_loop function in sysrepo

To help you get started, we’ve selected a few sysrepo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sysrepo / sysrepo / bindings / python / examples / python_application_changes_example.py View on Github external
# 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)
github sysrepo / sysrepo / bindings / python / examples / python_oper_get_data_example.py View on Github external
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)
github sysrepo / sysrepo / bindings / python / examples / python_application_example.py View on Github external
# 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)