Using gNMI with YANG Suite
==========================

Enabling gNMI in a device profile
---------------------------------

By default, device profiles are marked as not supporting gNMI. You'll need to
enable gNMI support when creating/editing the device profile.
If you're not familiar with the basic concepts of device profiles,
please refer to the device profile documentation at "Setup-->Device profiles".
Be sure to select the correct platform and port number, and perform a
connectivity check to verify this information is correct.

.. image:: images/devprofile_enablement.png
   :alt: Screenshot showing a device profile being edited to add gNMI support

Checking device capabilities
----------------------------

From the sidebar on any YANG Suite page, select "Protocols-->gNMI"
to reach the main gNMI page. Here, you can select a device to use.
Only device profiles that have enabled support for gNMI will be listed.

You can then click the "Capabilities" button for a report of the device's
gNMI capabilities.

.. image:: images/capabilities.png
   :alt: Screenshot of device capabilities report

Loading YANG modules
--------------------

First, you'll need to select a YANG module set.
(If you haven't already created one or more of these, see the
filemanager documentation at "Setup-->YANG files and repositories".)

.. image:: images/yangset_and_devprofile.png
   :alt: Screenshot showing a yangset and devprofile selected in the UI

After selecting the YANG set, select the "Module(s)" area, start typing in
the name or a portion of the name of the YANG file you wish to work from,
and pick one or more module(s).

.. image:: images/module_selection.png
   :alt: Screenshot of dropdown menu displaying YANG models matching a search

Then select the "Load Module(s)" button, and after a few moments, the selected
modules will be displayed.

.. image:: images/modules_loaded.png
   :alt: Screenshot of full page showing loaded YANG module trees

If you're not already familiar with the basic concepts of YANG Suite's tree UI
for working with YANG modules, please refer to the corresponding
documentation at "Explore-->YANG".

Building an RPC
---------------

Now that you have a device selected and YANG module(s) loaded, select the
desired operation (Get, Set, or Subscribe) and any associated options
(Get data type, prefixing style, etc.) using the buttons in the top section
of the page.

.. image:: images/rpc_options.png
   :alt: Screenshot showing the operation and options section of the UI.

In the YANG module tree display, you can then select the nodes of interest
(and the associated values and operations, for a Set request) that you wish
to use for building a gNMI RPC.

Get
'''

.. image:: images/tree_get.png
   :alt: Screenshot showing selections in the YANG tree for a Get request

Set
'''

.. image:: images/tree_set.png
   :alt: Screenshot showing selections in the YANG tree for a Set request.

Once you have made the desired selections, click "Build JSON" to construct
the corresponding RPC, which will be displayed as JSON in the field
to the right.

.. image:: images/get_json.png
   :alt: Screenshot showing a constructed Get request as JSON.

Running an RPC
--------------

Once you have constructed an RPC, simply select "Run RPC" to transmit it to
the selected device and display the outcome.

.. image:: images/rpc_run_get.png
   :alt: Screenshot showing the GetResponse received from a device.
