.. _retrieval_config_rpc:

Retrieving Configuration Data (NETCONF)
===========================================
Using NETCONFc, retrieving data from the connected server is a simple task.

Basic <get> and <get-config> operations
----------------------------------------

    From a module's ``schema tree`` in the ``Server Modules Advertised`` window on the left,
    using shortcut key ``<Ctrl + Z>`` for sending <get> 
    and ``Double-clicking`` for sending <get-config>, you can quickly browse and retrieve 
    state and config data from the server.

    Please see :ref:`basic_get` and :ref:`basic_get_config` for more information.

Retrieving multiple data nodes in a single request
---------------------------------------------------------
    
    You can select multiple nodes to include in your <get> and <get-config> requests, using
    (Ctrl + Click) or (Shift + Click). NETCONFc will automatically build XML data and send them happily for you!

    .. image:: images/select_multiple.*

    If the server supports with-defaults capability, you can rigth click and select one
    of the with-defaults options for the retrieving. For details on the meaning
    of ``with-defaults`` see :ref:`withDefaults`

Retrieving whole datastore data
---------------------------------------

    First select a ``config datastore`` by enabling the corresponding radio button,
    click the dropdown arrow button and select ``get all data`` or ``get all config data``

    .. image:: images/get_all_data.*
        
Retrieving data with subtree filtering 
------------------------------------------------------
    Sometimes you want to test your NETCONF server with a manually built subtree filter
    string. 

    Click the ``Retrieving data with manually built subtree filter ...`` toolbar button as shown below:

    .. image:: images/get_manual_subtree.*

    Then in the dialog popped up, select a target datastore if you want to issue
    <get-confg> (for <get>, the target is always ``running`` datastore), enter
    the full subtree filter XML string, and click the button ``get`` or ``get-config``

    .. image:: images/get_manual_subtree_dialog.*

    If the server supports with-defaults capability, you can select 
    one of the with-defaults options for the retrieving. For details on the meaning
    of ``with-defaults`` see :ref:`withDefaults`


Retrieving data with XPath filtering
-----------------------------------------

    If the server supports ``XPath`` capability, you can get or get-config with XPath
    filter.

    Click the ``Retrieving data with XPath ...`` toolbar button as shown below:
    .. image:: images/get_xpath.*

    Then in the dialog popped up, select a target datastore if you want to issue
    <get-confg> (for <get>, the target is always ``running`` datastore), enter
    the full xpath filter string, any prefix-namespace mapping in the format of
    "prefix=>namespace", one pair of mapping on each line, and then click the 
    button ``get`` or ``get-config``

    .. image:: images/get_xpath_dialog.*

    If the server supports with-defaults capability, you can select 
    one of the with-defaults options for the retrieving. For details on the meaning
    of ``with-defaults`` see :ref:`withDefaults`


.. _withDefaults:
 
Retrieving with with-defaults options
-------------------------------------
    If the server supports rfc6243, With-defaults Capability for NETCONF,
    you can get or get-config with one of the following options:

    *report-all: 
            all data nodes MUST be reported, including any data nodes considered 
            to be default data by the server.  

    *trim:  
            data nodes MUST NOT be reported if they contain the schema default 
            value. Non-configuration data nodes containing the
            schema default value MUST NOT be reported.

    *explicit:
            a data node that was set by a client to its schema default 
            value MUST be reported.  A conceptual data node that would
            be set by the server to the schema default value MUST NOT 
            be reported. Non-configuration data nodes containing the 
            schema default value MUST be reported.           

    *report-all-tagged: 
            In this mode the server returns all data nodes, 
            just like the 'report-all' mode, except a data node 
            that is considered
            by the server to contain default data will include an 
            XML attribute to indicate this condition.  This is useful for an application 
            to determine which nodes are considered to contains default data
            by the server, within a single retrieval operation. 


.. _retrieval_with_key:
        
Retrieving with list key nodes
------------------------------

    When you query a leaf node in a list, some server does not send back the value for 
    the list key nodes at the same time. In this case you will not be able to make much 
    sense out of the data you received. To work around this, by default NETCONFc will
    include keys node when requesting data from a list. You can turn off NETCONFc's `
    `Retrieving with list key`` option by right-clicking on any node as shown below:

    .. image:: images/retrieval_with_key.*
        
    After that, when you perform a <get> or <get-config>, list key nodes in the ancestors
    will not be added into the subtree selection filter automatically.
    
Send a <get> request with content match subtree filtering
----------------------------------------------------------
    
    Select one or more nodes in the module tree, click the ``Value`` cells and enter the value 
    you want to match in subtree filtering, then hit <Ctrl + Space> to send <get> or
    double-clicking to send <get-config>.

    .. image:: images/content-match.*
    

    
    
