# Finding the correct YANG model #2

Configure MDT using the solution from the first lab:

```
#XR1
telemetry model-driven
 destination-group TIG
  address-family ipv4 10.100.100.1 port 57500
   encoding self-describing-gpb
   protocol grpc no-tls
  !
 !
 sensor-group SENSOR1
  sensor-path Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface/latest/generic-counters
 !
 subscription SUB1
  sensor-group-id SENSOR1 sample-interval 5000
  destination-id TIG
```



Configure a static delay value for Gi0/0/0/0.12 under performance-measurement. Add an additional sensor-path which exports the performance measurement delay for only this interface.













































## Answer <a href="#id-51219ff0-d610-4536-af7d-245172f02196" id="id-51219ff0-d610-4536-af7d-245172f02196"></a>

```
performance-measurement
 interface GigabitEthernet0/0/0/0.12
  delay-measurement
   advertise-delay 123
!
telemetry model-driven
 sensor-group SENSOR1
  sensor-path Cisco-IOS-XR-perf-meas-oper:performance-measurement/nodes/node/interfaces/interface-details/interface-detail[interface-name="GigabitEthernet0/0/0/0.12"]/delay-measurement-session/last-advertisement-information/advertised-values/minimum
```



## Explanation <a href="#id-23f228ac-5d2b-43c9-9799-a4af68b1598f" id="id-23f228ac-5d2b-43c9-9799-a4af68b1598f"></a>

This path is a bit easier to find. First I use **yang-operational** to find the YANG model that contains the show output for performance-measurement:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FqQi5zsWGiB76JCEJSUnJ%2Fimage.png?alt=media&#x26;token=f6c2462a-b251-4933-ba1a-f8501467105e" alt=""><figcaption></figcaption></figure></div>



Next, I limit the output to only interface Gi0/0/0/0.12. This is very similar to limiting the output of the interface’s general statistics we saw in the “Filtering Data using XPATH” lab.

```
Cisco-IOS-XR-perf-meas-oper:performance-measurement/nodes/node/interfaces/interface-details/interface-detail[interface-name="GigabitEthernet0/0/0/0.12"]
```



At this point, you can be done with the path. Optionally, you can continue drilling down onto just the minimum advertised value. I found this path by copying and pasting the output from **run mdt\_exec** into python and using pprint.

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2F48YEyjqQHXPRdSJzCMYW%2Fimage.png?alt=media&#x26;token=2bd407c0-fcec-42c4-800e-e2594e4c8572" alt=""><figcaption></figcaption></figure></div>



Use the following Grafana query:

```
from(bucket: "telemetry")
  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)
  |> filter(fn: (r) =>
    r._measurement == "Cisco-IOS-XR-perf-meas-oper:performance-measurement/nodes/node/interfaces/interface-details/interface-detail" and
    r._field == "delay_measurement_session/last_advertisement_information/advertised_values/minimum"
  )
```



You should see the static value of 123:

<figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FjJTSykUEsYbwsOeJCkbg%2Fimage.png?alt=media&#x26;token=1692c15a-19ff-46e7-87e8-0739cd99722b" alt=""><figcaption></figcaption></figure>
