def call_rpc(cmd=None, *args, **kwargs):
    conn = __proxy__['junos.conn']()
    ret = dict()
    ret['out'] = True

    op = dict()
    if '__pub_arg' in kwargs and isinstance(kwargs['__pub_arg'][-1], dict):
        op.update(kwargs['__pub_arg'][-1])
    else:
        op.update(kwargs)

    for k, v in op.iteritems():
        op[k] = str(v)
    op['format'] = 'json'

    try:
        if cmd in ['get-config', 'get_config']:
            filter_reply = None
            if len(args) > 0:
                filter_reply = etree.XML(args[0])
            ret['message'] = getattr(conn.rpc, cmd.replace('-', '_'))(filter_reply, options=op)
        else:
            ret['message'] = getattr(conn.rpc, cmd.replace('-', '_'))(op)

    except Exception as exception:

        ret['message'] = 'Execution failed due to "{0}"'.format(exception)
        ret['out'] = False

    if 'dest' in op:
        f = open(op['dest'], 'w')
        f.write(ret['message'])
        f.close()

    return ret
This function executes the rpc provided as arguments on the junos device.
dataset/ETHPy150Open saltstack/salt/salt/modules/junos.py/call_rpc