How to use the sysrepo.Data_Node 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_oper_get_data_example.py View on Github external
ifc = sr.Data_Node(parent, mod, "interface")
        name = sr.Data_Node(ifc, mod, "name", "eth100")
        typ = sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd")
        oper_status = sr.Data_Node(ifc, mod, "oper-status", "down")

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth101"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "up"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth102"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "dormant"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth105"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "not-present"));

    except Exception as e:
        print (e)
        return sr.SR_ERR_OK
    return sr.SR_ERR_OK
github sysrepo / sysrepo / bindings / python / examples / python_oper_get_data_example.py View on Github external
parent.reset(sr.Data_Node(ctx, "/ietf-interfaces:interfaces-state", None, sr.LYD_ANYDATA_CONSTSTRING, 0))
        ifc = sr.Data_Node(parent, mod, "interface")
        name = sr.Data_Node(ifc, mod, "name", "eth100")
        typ = sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd")
        oper_status = sr.Data_Node(ifc, mod, "oper-status", "down")

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth101"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "up"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth102"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "dormant"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth105"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "not-present"));

    except Exception as e:
        print (e)
        return sr.SR_ERR_OK
    return sr.SR_ERR_OK
github sysrepo / sysrepo / bindings / python / examples / python_oper_get_data_example.py View on Github external
mod = ctx.get_module(module_name)

        parent.reset(sr.Data_Node(ctx, "/ietf-interfaces:interfaces-state", None, sr.LYD_ANYDATA_CONSTSTRING, 0))
        ifc = sr.Data_Node(parent, mod, "interface")
        name = sr.Data_Node(ifc, mod, "name", "eth100")
        typ = sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd")
        oper_status = sr.Data_Node(ifc, mod, "oper-status", "down")

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth101"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "up"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth102"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "dormant"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth105"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "not-present"));

    except Exception as e:
        print (e)
        return sr.SR_ERR_OK
    return sr.SR_ERR_OK
github sysrepo / sysrepo / bindings / python / examples / python_oper_get_data_example.py View on Github external
def oper_get_items_cb1(session, module_name, path, request_xpath, request_id, parent, private_data):
    print ("\n\n ========== CALLBACK CALLED TO PROVIDE \"" + path + "\" DATA ==========\n")
    try:
        ctx = session.get_context()
        mod = ctx.get_module(module_name)

        parent.reset(sr.Data_Node(ctx, "/ietf-interfaces:interfaces-state", None, sr.LYD_ANYDATA_CONSTSTRING, 0))
        ifc = sr.Data_Node(parent, mod, "interface")
        name = sr.Data_Node(ifc, mod, "name", "eth100")
        typ = sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd")
        oper_status = sr.Data_Node(ifc, mod, "oper-status", "down")

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth101"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "up"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth102"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "dormant"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth105"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
github sysrepo / sysrepo / bindings / python / examples / python_oper_get_data_example.py View on Github external
def oper_get_items_cb2(session, module_name, path, request_xpath, request_id, parent, private_data):
    print ("\n\n ========== CALLBACK CALLED TO PROVIDE \"" + path + "\" DATA ==========\n")
    try:
        ctx = session.get_context()
        mod = ctx.get_module(module_name)

        stats = sr.Data_Node(parent, mod, "statistics")
        dis_time = sr.Data_Node(stats, mod, "discontinuity-time", "2019-01-01T00:00:00Z")
        in_oct = sr.Data_Node(stats, mod, "in-octets", "22")

    except Exception as e:
        print (e)
        return sr.SR_ERR_OK
    return sr.SR_ERR_OK
github sysrepo / sysrepo / bindings / python / examples / python_oper_get_data_example.py View on Github external
oper_status = sr.Data_Node(ifc, mod, "oper-status", "down")

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth101"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "up"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth102"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "dormant"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth105"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "not-present"));

    except Exception as e:
        print (e)
        return sr.SR_ERR_OK
    return sr.SR_ERR_OK
github sysrepo / sysrepo / bindings / python / examples / python_oper_get_data_example.py View on Github external
ctx = session.get_context()
        mod = ctx.get_module(module_name)

        parent.reset(sr.Data_Node(ctx, "/ietf-interfaces:interfaces-state", None, sr.LYD_ANYDATA_CONSTSTRING, 0))
        ifc = sr.Data_Node(parent, mod, "interface")
        name = sr.Data_Node(ifc, mod, "name", "eth100")
        typ = sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd")
        oper_status = sr.Data_Node(ifc, mod, "oper-status", "down")

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth101"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "up"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth102"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "dormant"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth105"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "not-present"));

    except Exception as e:
        print (e)
        return sr.SR_ERR_OK
    return sr.SR_ERR_OK
github sysrepo / sysrepo / bindings / python / examples / python_oper_get_data_example.py View on Github external
def oper_get_items_cb1(session, module_name, path, request_xpath, request_id, parent, private_data):
    print ("\n\n ========== CALLBACK CALLED TO PROVIDE \"" + path + "\" DATA ==========\n")
    try:
        ctx = session.get_context()
        mod = ctx.get_module(module_name)

        parent.reset(sr.Data_Node(ctx, "/ietf-interfaces:interfaces-state", None, sr.LYD_ANYDATA_CONSTSTRING, 0))
        ifc = sr.Data_Node(parent, mod, "interface")
        name = sr.Data_Node(ifc, mod, "name", "eth100")
        typ = sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd")
        oper_status = sr.Data_Node(ifc, mod, "oper-status", "down")

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth101"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "up"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth102"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "dormant"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth105"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "not-present"));

    except Exception as e:
        print (e)
        return sr.SR_ERR_OK
    return sr.SR_ERR_OK
github sysrepo / sysrepo / bindings / python / examples / python_oper_get_data_example.py View on Github external
def oper_get_items_cb1(session, module_name, path, request_xpath, request_id, parent, private_data):
    print ("\n\n ========== CALLBACK CALLED TO PROVIDE \"" + path + "\" DATA ==========\n")
    try:
        ctx = session.get_context()
        mod = ctx.get_module(module_name)

        parent.reset(sr.Data_Node(ctx, "/ietf-interfaces:interfaces-state", None, sr.LYD_ANYDATA_CONSTSTRING, 0))
        ifc = sr.Data_Node(parent, mod, "interface")
        name = sr.Data_Node(ifc, mod, "name", "eth100")
        typ = sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd")
        oper_status = sr.Data_Node(ifc, mod, "oper-status", "down")

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth101"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "up"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth102"));
        typ.reset(sr.Data_Node(ifc, mod, "type", "iana-if-type:ethernetCsmacd"));
        oper_status.reset(sr.Data_Node(ifc, mod, "oper-status", "dormant"));

        ifc.reset(sr.Data_Node(parent, mod, "interface"));
        name.reset(sr.Data_Node(ifc, mod, "name", "eth105"));