# Basic Dial-In using gNMI

On the ubuntu server (10.200.255.4), bring down the TIG stack using **sudo docker compose down**.



Edit the docker-compose file so that dial\_in is used. Comment out dial\_out.

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FDCRk0oPbufZWC7YajzfC%2Fimage.png?alt=media&#x26;token=97f260e1-e314-44d2-94cd-b2009efb52e3" alt=""><figcaption></figcaption></figure></div>



In NSO, edit the **telegraf\_dial\_in.conf** file and scroll down to “INPUT PLUGINS.” Change the addresses and username/password credentials:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FyZ96dQg8jLcEAoX0VTMG%2Fimage.png?alt=media&#x26;token=ad193ced-5831-40b7-b7b4-5ebf080e2466" alt=""><figcaption></figcaption></figure></div>



Launch the docker container using:

```
sudo docker compose up -d
```



Configure Dial-In MDT on XR1 using the following parameters:

* Use port 57400
* Do not use TLS













































## Answer <a href="#id-32a16537-d5e2-4f36-9da3-4400d7017583" id="id-32a16537-d5e2-4f36-9da3-4400d7017583"></a>

```
#XR1
grpc
 port 57400
 no-tls
```



## Explanation <a href="#id-691bbc69-5f55-4393-9f2e-e9e989509513" id="id-691bbc69-5f55-4393-9f2e-e9e989509513"></a>

MDT using dial-in session initiation is very simple to configure on IOS-XR. You can only use gRPC for dial-in, so all you do is start the gRPC server, set the port, and configure TLS settings. In this lab, we are not using TLS, so we simply use the **no-tls** keyword.



All of the complexity is present on the TIG container. This container is already configured with the YANG model path information.

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FTFvZFEZvD2KGMLXtLU43%2Fimage.png?alt=media&#x26;token=42a62cef-7936-4449-b620-bd7469947f17" alt=""><figcaption></figcaption></figure></div>



On IOS-XR, we can confirm that the session is up:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2F2umaJKEzvjz69SDkr8iC%2Fimage.png?alt=media&#x26;token=c17cea2b-7d07-439b-b453-1103dd8d1c37" alt=""><figcaption></figcaption></figure></div>



Above we see that the destination is dialin. Due to this, the group ID and subscription ID appear to be dynamically generated. The IDs beginning with **GNMI\_\_ refers** to the fact that gNMI is used for the dialin session.

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FJ8dBa5o88x45FW3fGRbd%2Fimage.png?alt=media&#x26;token=8ea48c3d-14bc-4f95-b158-78442baf8a48" alt=""><figcaption></figcaption></figure></div>



We can also see that the sensor paths were dynamically created. We can tell because the group ID begins with **GNMI\_\_**

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FRkLYU7vJm0MtNbHZL6wZ%2Fimage.png?alt=media&#x26;token=2ff276ca-38fe-406c-a2f2-f3e59fbb87ee" alt=""><figcaption></figcaption></figure></div>



We should also be aware of the commands to view more general gRPC status. The following command shows that the gRPC server is running, TLS is disabled, and the router is listening on port 57400.

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FmFZ12ydNXjdQYeOgcShr%2Fimage.png?alt=media&#x26;token=6bdde478-7afc-4367-8037-4b512ec56fc5" alt=""><figcaption></figcaption></figure></div>



We can also see the current gRPC streams:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FQMr6DjNbWyIKCzXFtsFx%2Fimage.png?alt=media&#x26;token=d6dc3be4-cdef-4117-8cce-e76b7972941d" alt=""><figcaption></figcaption></figure></div>



Interestingly, the gRPC statistics shows all counters as zero. All of these appear to be actions such as replace/delete config, get operational data, etc.

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2F5QhRqHpWOFCILDlCYJWx%2Fimage.png?alt=media&#x26;token=e162d5a6-7bf0-4d3f-ac5f-a95c09aaeb64" alt=""><figcaption></figcaption></figure></div>



## About gNMI <a href="#f10e74cf-131b-4af6-8511-39b82af1426f" id="f10e74cf-131b-4af6-8511-39b82af1426f"></a>

gNMI stands for gRPC Network Management Interface. This is a network management protocol that is yang-based, very much like NETCONF. Where NETCONF uses SSH for transport, gNMI uses gRPC (which itself uses HTTP2, which allows for TLS). Where NETCONF uses XML for encoding, gNMI uses proto buffs. This allows for compressed data, giving gNMI better throughput and scalability than NETCONF.



gNMI uses four functions:

* Capabilities
* Get
* Set
* Subscribe



The subscribe function is what we are interested in for MDT. The collector initiates (dials in) the session with the router, and using the subscribe function, specifies the YANG model, encoding type, and streaming interval (i.e. 30seconds). This is why we don’t have to configure any of these parameters on the router itself.



You may have seen that IOS-XR has recently begun supporting gNMI for dialout as well. How can that work? The way it works is that the router initiates a session with the collector using the **grpc tunnel** command. This appears to just allow the collector to learn about the router. Then the collector initiates the MDT session by using the subscribe function like normal. So gNMI still works the same as always. The difference is just that the router can inform the collector of its presence, allowing the collector to send the subscribe message and start the MDT session.
