How To Get Telemetry sensor path for show cmd on IOS XR?

When we want to collect some show information by Telemetry, we will face the 1st question that how to find the correct/resolved sensor path. The first step often traps us. Is there any good way to easily find the sensor path? The answer is “Yes”. I had summarized a way that can help you quickly find the sensor path.

Before read the article,there is a file that mapping between YANG and Sensor Path in XR, you can check by keyword(e.g fan, cpu and so on) first, if not found, then check my article.

RP/0/RP0/CPU0:XTC#run
Tue Jan 22 06:58:56.512 UTC
[xr-vm_node0_RP0_CPU0:~]$cd /pkg/telemetry/mdt/protogen
[xr-vm_node0_RP0_CPU0:/pkg/telemetry/mdt/protogen]$ls
yang_to_schema.txt
[xr-vm_node0_RP0_CPU0:/pkg/telemetry/mdt/protogen]$

yang_to_Schema.txt has all yang path to xml schema path maps. https://github.com/AlexFengCisco/Telemetry_Receiver

How to get the following result by Telemetry?

At first, you need to know which yang file mapping the cmd.

RP/0/RP0/CPU0:iosxrv-2#show segment-routing traffic-eng forwarding policy name test-policy detail
Fri Feb 22 05:35:23.723 UTC
Policy        Segment         Outgoing    Outgoing            Next Hop        Bytes      
Name          List            Label       Interface                           Switched   
------------- --------------- ----------- ------------------- --------------- ------------
test-policy   test-app1       16004       Gi0/0/0/1           10.0.0.10       1040        
                 Label Stack (Top -> Bottom): { 16004 }
                 Path-id: 1, Weight: 5
                 Packets Switched: 10
              test-app2       Pop         Gi0/0/0/2           10.0.0.14       1040       
                 Label Stack (Top -> Bottom): { Pop }
                 Path-id: 2, Weight: 3
                 Packets Switched: 10
   Local label: 24000
   Packets/Bytes Switched: 20/2160
   (!): FRR pure backup

How to get the YANG files for the show cmd?

Now our IOS XR have a new command that can easy to achieve the requirement, as follow: 

RP/0/RP0/CPU0:iosxrv-2#schema-describe show segment-routing traffic-eng forwarding policy name test-policy detail
Fri Feb 22 07:38:31.988 UTC
Action: get
Path:   RootOper.XTC.Forwarding.PolicyForwarding({'Name': 'test-policy'})

RP/0/RP0/CPU0:iosxrv-2#

How to get diff version YANG files?

Based on the above command, the “XTC.Forwarding.PolicyForwarding” is what we want. We need to filter all YANG File by the keyword. “cfg” YANG relation with configuration; “oper” relation with show cmd. So we only focus “oper” YANG files.

How to get correct sensor path?

Based on above filter result,  check all “oper” YANG files by pyang, then find correct files, as follow:

XXXXXXXX-M-L2HE:661-yang xxxxxxxx$ pyang --format tree --tree-depth 6 [email protected] --tree-path /xtc/forwarding

module: Cisco-IOS-XR-infra-xtc-agent-oper
  +--ro xtc
     +--ro forwarding
        +--ro policy-forwardings
           +--ro policy-forwarding* [name]
              +--ro name                      xr:Cisco-ios-xr-string
              +--ro policy-name?              string
              +--ro is-local-label-valid?     boolean
              +--ro local-label?              uint32
              +--ro are-stats-valid?          boolean
              +--ro forwarding-stats-pkts?    uint64
              +--ro forwarding-stats-bytes?   uint64
              +--ro paths* []
                 +--ro outgoing-interface?       xr:Interface-name
                 +--ro next-hop-ipv4?            Xtc-ipv4-address
                 +--ro next-hop-table-id?        uint32
                 +--ro is-protected?             boolean
                 +--ro is-pure-bkup?             boolean
                 +--ro load-metric?              uint32
                 +--ro path-id?                  uint8
                 +--ro bkup-path-id?             uint8
                 +--ro segment-list-name?        string
                 +--ro are-stats-valid?          boolean
                 +--ro forwarding-stats-pkts?    uint64
                 +--ro forwarding-stats-bytes?   uint64
                 +--ro label-stack*              uint32

Sometimes, Yang file include many diff info, if you want to only get some part info, need to narrown the sensor path, the easiest way is get an example, then check exactly sensor path, e.g you want to get EVPN static info, you can get sensor path “Cisco-IOS-XR-l2vpn-oper:/l2vpnv2/active” by above way.

RP/0/RP0/CPU0:iosxrv-1#show l2vpn xconnect group frank xc-name evpn1 detail
Tue Apr 30 22:02:08.727 UTC
 
Group frank, XC evpn1, state is up; Interworking none
  AC: GigabitEthernet0/0/0/0.1, state is up
    Type VLAN; Num Ranges: 1
    Rewrite Tags: []
    VLAN ranges: [11, 11]
    MTU 1500; XC ID 0x6; interworking none
    Statistics:
      packets: received 14, sent 14  <<<
      bytes: received 1004, sent 1004  <<<
      drops: illegal VLAN 0, illegal length 0
  EVPN: neighbor 192.168.0.2, PW ID: evi 101, ac-id 21, state is up ( established )
    XC ID 0xa0000003
    Encapsulation MPLS
    Source address 192.168.0.1
    Encap type Ethernet, control word enabled
    Sequencing not set
    Preferred path Active : SR TE port1, Statically configured, fallback enabled
    Tunnel : Up
    Load Balance Hashing: src-dst-ip
 
      EVPN         Local                          Remote                       
      ------------ ------------------------------ -----------------------------
      Label        24002                          24002                        
      MTU          1500                           1500                         
      Control word enabled                        enabled                      
      AC ID        11                             21                           
      EVPN type    Ethernet                       Ethernet                     
 
      ------------ ------------------------------ -----------------------------
    Create time: 24/04/2019 09:56:45 (6d12h ago)
    Last time status changed: 24/04/2019 22:15:34 (5d23h ago)
    Statistics:
      packets: received 14, sent 14   <<<
      bytes: received 1004, sent 1004  <<<

There are two parts counter, face core and face AC.

RP/0/RP0/CPU0:iosxrv-1#show l2vpn xconnect       
Wed May  1 00:37:32.910 UTC
Legend: ST = State, UP = Up, DN = Down, AD = Admin Down, UR = Unresolved,
        SB = Standby, SR = Standby Ready, (PP) = Partially Programmed
 
XConnect                   Segment 1                       Segment 2               
Group      Name       ST   Description            ST       Description            ST   
------------------------   -----------------------------   -----------------------------
frank      evpn1      UP   Gi0/0/0/0.1            UP       EVPN 101,21,192.168.0.2
                                                                                  UP   
----------------------------------------------------------------------------------------
frank      evpn2      UP   Gi0/0/0/0.2            UP       EVPN 102,22,192.168.0.2
                                                                                  UP   
----------------------------------------------------------------------------------------
frank      evpn3      UP   Gi0/0/0/0.3            UP       EVPN 103,23,192.168.0.2
                                                                                  UP   
----------------------------------------------------------------------------------------

XR will pull all active yang data to telemetry server, then grep by following Linux cmd and get correct sensor path:

[root@telemetry opt]# grep -E 'encoding_path|1004' dump-frank.txt
        "encoding_path": "Cisco-IOS-XR-l2vpn-oper:l2vpnv2/active/xconnect-brief",
        "encoding_path": "Cisco-IOS-XR-l2vpn-oper:l2vpnv2/active/xconnect-brief",
        "encoding_path": "Cisco-IOS-XR-l2vpn-oper:l2vpnv2/active/l2vpn-pbb-bsa",
        "encoding_path": "Cisco-IOS-XR-l2vpn-oper:l2vpnv2/active/l2vpn-collaborators",
        "encoding_path": "Cisco-IOS-XR-l2vpn-oper:l2vpnv2/active/pseudowire-classes/pseudowire-class",
        "encoding_path": "Cisco-IOS-XR-l2vpn-oper:l2vpnv2/active/discovery-summary",
        "encoding_path": "Cisco-IOS-XR-l2vpn-oper:l2vpnv2/active/l2vpn-resource-state",
        "encoding_path": "Cisco-IOS-XR-l2vpn-oper:l2vpnv2/active/proc-fsm",
        "encoding_path": "Cisco-IOS-XR-l2vpn-oper:l2vpnv2/active/xconnect-summary",
        "encoding_path": "Cisco-IOS-XR-l2vpn-oper:l2vpnv2/active/indexes/index",
        "encoding_path": "Cisco-IOS-XR-l2vpn-oper:l2vpnv2/active/xconnect-groups/xconnect-group",
        "encoding_path": "Cisco-IOS-XR-l2vpn-oper:l2vpnv2/active/xconnects/xconnect", <<<
                                    "byte-counts": 1004, <<<
                                    "byte-counts": 1004, <<<
                                    "byte-counts": 1004, <<<
                                    "byte-counts": 1004, <<<

Follow detail information example:

Summary: GPB(common) Message [10.75.177.41:34602(iosxrv-1)/Cisco-IOS-XR-l2vpn-oper:l2vpnv2/active/xconnects/xconnect msg len: 24873]
{
    "Source": "10.75.177.41:34602",
    "Telemetry": {
        "node_id_str": "iosxrv-1",
        "subscription_id_str": "l2vpn",
        "encoding_path": "Cisco-IOS-XR-l2vpn-oper:l2vpnv2/active/xconnects/xconnect",
        "collection_id": 2476,
        "collection_start_time": 1556670622067,
        "msg_timestamp": 1556670622067,
        "collection_end_time": 1556670622073
    },
    "Rows": [
        {
            "Timestamp": 1556670622072,
            "Keys": {
                "group-name": "frank",
                "xconnect-name": "evpn1"
            },
            "Content": {
                "backup": {
                    "segment-type": "l2vpn-segment-type-unresolved"
                },
                "backup-segment": {
                    "segment-type": "l2vpn-segment-type-unresolved"
                },
                "ce2ce": {
                    "ce-added": "false",
                    "local-customer-edge-id": 0,
                    "remote-customer-edge-id": 0
                },
                "diag-mask": 0,
                "group-name-xr": "frank",
                "interworking": "l2vpn-iw-type-none",
                "is-mp2mp": "false",
                "number-of-backup-p-ws": 0,
                "segment1": {
                    "attachment-circuit": {
                      ......
                        "statistics": {
                            "dispostion-stats": {
                                ......
                                "disposition-stat": {
                                    "byte-counts": 1004,
                                    "packet-counts": 14
                                },
                                ......
                            },
                            "impostion-stats": {
                                ......
                                "imposition-stat": {
                                    "byte-counts": 1004,
                                    "packet-counts": 14
                                },
                                ......

                            },
                            "sequence-number": {
                                "bypassed-inbound-sequence-packet": 0,
                                "bypassed-out-sequence-packet": 0,
                                "sequence-number-expected": 0,
                                "sequence-number-sent": 0
                            }
                        },
                        "tdm-media-mismatched": "false",
                        "xconnect-id": 6
                    },
                    "segment-type": "l2vpn-segment-type-ac"
                },
                "segment2": {
                    "pseudo-wire": {
                        "ad-method": 0,
                        ......
                        "state": "l2vpn-segment-state-up",
                        "statistics": {
                            "dispostion-stats": {
                                ......

                                "disposition-stat": {
                                    "byte-counts": 1004,
                                    "packet-counts": 14
                                },
                                ......

                            },
                            "impostion-stats": {
                                ......

                                "imposition-stat": {
                                    "byte-counts": 1004,
                                    "packet-counts": 14
                                },
                                ......

                            },
                            "sequence-number": {
                                "bypassed-inbound-sequence-packet": 0,
                                "bypassed-out-sequence-packet": 0,
                                "sequence-number-expected": 0,
                                "sequence-number-sent": 0
                            }
                        },
                        "tag-rewrite": 0,
                        "time-created": "24/04/2019 09:56:45",
                        "time-elapsed-creation": "6d14h",
                        "time-elapsed-status-changed": "6d02h",
                        "time-elapsed-status-down": 0,
                        "transport-lsp-down": "false",
                        "use-tunnel-path": "true",
                        "xconnect-id": 2684354563
                    },
                    "segment-type": "l2vpn-segment-type-pw"
                },
                "state": "l2vpn-xc-state-up",
                "xconnect-name-xr": "evpn1"
            }
        },

Then check path by yang tools:

XXXXXXXX-M-L2HE:661-yang XXXXXXXX$ pyang --format tree --tree-depth 5 --tree-path /l2vpnv2/active/xconnects /Users/XXXXXXXX/Documents/Yangsuite_data/users/root/repositories/661-yang/[email protected] 
module: Cisco-IOS-XR-l2vpn-oper
  +--ro l2vpnv2
     +--ro active
        +--ro xconnects
           +--ro xconnect* [group-name xconnect-name]
              +--ro group-name               xr:Cisco-ios-xr-string
              +--ro xconnect-name            string
              +--ro backup
              |     ...
              +--ro segment1
              |     ...
              +--ro segment2
              |     ...
              +--ro ce2ce
              |     ...
              +--ro group-name-xr?           string
              +--ro xconnect-name-xr?        string
              +--ro number-of-backup-p-ws?   uint32
              +--ro state?                   L2vpn-xc-state
              +--ro interworking?            L2vpn-interworking
              +--ro diag-mask?               uint32
              +--ro description?             string
              +--ro is-mp2mp?                boolean
              +--ro backup-segment* []
                    ...

Deploy Telemetry on XRv9k

RP/0/RP0/CPU0:iosxrv-2#sh run telemetry model-driven 
Fri Feb 22 08:05:37.116 UTC
telemetry model-driven
 destination-group spr-telemetry
  address-family ipv4 10.75.58.x port 5432
   encoding self-describing-gpb
   protocol tcp
  !
 !
 sensor-group sr-policy-forwarding
  sensor-path Cisco-IOS-XR-infra-xtc-agent-oper:xtc/forwarding
 !
 subscription test
  sensor-group-id sr-policy-forwarding strict-timer
  sensor-group-id sr-policy-forwarding sample-interval 5000
  destination-id spr-telemetry
 !
!

Deploy Telemetry Server by “pipeline”

More detail information, please check original article: Quick startup guide for Model Driven Telemetry testing

  • Clone the GIT project: “git clone https://github.com/cisco/bigmuddy-network-telemetry-pipeline.git”
  • Update file path “cp pipeline.conf pipeline-file.conf”, “vi pipeline-file.conf”: “file = /opt/dump-frank.txt”
  • Enable pipeline by “./bin/pipeline -log= -config=pipeline-file.conf”
[root@telemetry bigmuddy-network-telemetry-pipeline]# ./bin/pipeline -log= -config=pipeline-file.conf &
[1] 20204
[root@telemetry bigmuddy-network-telemetry-pipeline]# INFO[2019-02-22 13:31:44.592956] Conductor says hello, loading config          config=pipeline-file.conf debug=false fluentd= logfile= max"
INFO[2019-02-22 13:31:44.593665] Conductor starting up section                 name=conductor section=inspector stage="xport_output" tag=pipeline
INFO[2019-02-22 13:31:44.593700] Conductor starting up section                 name=conductor section=testbed stage="xport_input" tag=pipeline
INFO[2019-02-22 13:31:44.594042] TCP server starting                           listen=":5432" name=testbed tag=pipeline
INFO[2019-02-22 13:31:44.594082] Metamonitoring: serving pipeline metrics to prometheus  name=default resource="/metrics" server=":8989" tag=pipeline
INFO[2019-02-22 13:31:44.594133] Starting up tap                               countonly=false filename="/opt/dump-frank.txt" name=inspector streamSpec=&{2 <nil>} tag=pipeline

INFO[2019-02-22 13:32:01.417426] TCP server accepted connection                encap=st keepalive=0s local="10.75.177.x:5432" name=testbe
 /opt/dump-frank.txt 

Check Telemetry status and sensor status

RP/0/RP0/CPU0:iosxrv-2#show telemetry model-driven subscription test internal 
Fri Feb 22 05:24:29.874 UTC
Subscription:  test
-------------
  State:       ACTIVE <<<
  Sensor groups:
  Id: sr-policy-forwardin
    Sample Interval:      5000 ms
    Sensor Group State:   Not Configured
  Id: sr-policy-forwarding
    Sample Interval:      0 ms
    Sensor Path:          Cisco-IOS-XR-infra-xtc-agent-oper:xtc/forwarding
    Sensor Path State:    Resolved  <<<

  Destination Groups:
  Group Id: spr-telemetry
    Destination IP:       10.75.58.x
    Destination Port:     5432
    Encoding:             self-describing-gpb
    Transport:            tcp
    State:                Active
    No TLS                
    Total bytes sent:     1028
    Total packets sent:   1
    Last Sent time:       2019-02-22 05:22:19.3327875298 +0000
          
  Collection Groups:
  ------------------
    Id: 1
    Sample Interval:      0 ms (strict-timer)
    Encoding:             self-describing-gpb
    Num of collection:    1
    Collection time:      Min:    14 ms Max:    14 ms
    Total time:           Min:    15 ms Avg:    15 ms Max:    15 ms
    Total Deferred:       2
    Total Send Errors:    0
    Total Send Drops:     0
    Total Other Errors:   0
    No data Instances:    0
    Last Collection Start:2019-02-22 05:22:19.3327860298 +0000
    Last Collection End:  2019-02-22 05:22:19.3327875298 +0000
    Sensor Path:          Cisco-IOS-XR-infra-xtc-agent-oper:xtc/forwarding

      Sysdb Path:     /oper/xtc/gl/fwd/policy/*
      Count:          1 Method: DATALIST Min: 14 ms Avg: 14 ms Max: 14 ms
      Item Count:     3 Status: Eventing Not Active
      Missed Collections:0  send bytes: 1016 packets: 1 dropped bytes: 0
                      success         errors          deferred/drops  
      Gets            0               0               
      List            0               0               
      Datalist        3               0               
      Finddata        0               0               
      GetBulk         0               0               
      Encode                          0               2               
      Send                            0               0   

RP/0/RP0/CPU0:iosxrv-2#show telemetry model-driven subscription               
Fri Feb 22 05:26:48.532 UTC
Subscription:  test                     State: ACTIVE
-------------
  Sensor groups:
  Id                               Interval(ms)        State     
  sr-policy-forwarding             5000                Resolved  

  Destination Groups:
  Id                 Encoding            Transport   State   Port    Vrf     IP            
  spr-telemetry      self-describing-gpb tcp         Active  5432            10.75.58.x   
    No TLS            

Check Telemetry output

[root@telemetry bigmuddy-network-telemetry-pipeline]# more /opt/dump-frank.txt 

------- 2019-02-22 13:32:36.440485402 +0800 CST -------
Summary: GPB(common) Message [10.75.177.x:47896(iosxrv-2)/Cisco-IOS-XR-infra-xtc-agent-oper:xtc/forwarding/policy-forwardings/policy-forwarding msg len: 1016]
{
    "Source": "10.75.177.x:47896",
    "Telemetry": {
        "node_id_str": "iosxrv-2",
        "subscription_id_str": "test",
        "encoding_path": "Cisco-IOS-XR-infra-xtc-agent-oper:xtc/forwarding/policy-forwardings/policy-forwarding",
        "collection_id": 53,
        "collection_start_time": 1550813493363,
        "msg_timestamp": 1550813493363,
        "collection_end_time": 1550813493372
    },
    "Rows": [
        {
            "Timestamp": 1550813493371,
            "Keys": {
                "name": "test-policy"
            },
            "Content": {
                "are-stats-valid": "true",
                "forwarding-stats-bytes": 2160,
                "forwarding-stats-pkts": 20,
                "is-local-label-valid": "true",
                "local-label": 24000,
                "path_PIPELINE_EDIT": [
                    {
                        "are-stats-valid": "true",
                        "bkup-path-id": 0,
                        "forwarding-stats-bytes": 1040,
                        "forwarding-stats-pkts": 10,
                        "is-protected": "false",
                        "is-pure-bkup": "false",
                        "label-stack": 16004,
                        "load-metric": 5,
                        "next-hop-ipv4": "10.0.0.10",
                        "next-hop-table-id": 3758096384,
                        "outgoing-interface": "GigabitEthernet0/0/0/1",
                        "path-id": 1,
                        "segment-list-name": "test-app1"
                    },
                    {
                        "are-stats-valid": "true",
                        "bkup-path-id": 0,
                        "forwarding-stats-bytes": 1040,
                        "forwarding-stats-pkts": 10,
                        "is-protected": "false",
                        "is-pure-bkup": "false",
                        "label-stack": 3,
                        "load-metric": 3,
                        "next-hop-ipv4": "10.0.0.14",
                        "next-hop-table-id": 3758096384,
                        "outgoing-interface": "GigabitEthernet0/0/0/2",
                        "path-id": 2,
                        "segment-list-name": "test-app2"
                    }
                ],
                "policy-name": "test-policy"
            }
        }
    ]
}

Some sensor Paths

MDT PathPurpose
Cisco-IOS-XR-clns-isis-oper:isis/instances/instance/topologies/topology/ipv4-routes/ipv4-route/native-status/native-details/primary/sourceSR Labels
Cisco-IOS-XR-infra-xtc-agent-oper:xtc/forwardingSR Policy
Cisco-IOS-XR-clns-isis-oper:isis/instances/instance/topologies/topology/ipv4frr-backups/ipv4frr-backup/native-status/native-details/primary/paths/frr-backup
Cisco-IOS-XR-clns-isis-oper:isis/instances/instance/topologies/topology/frr-summary
TI-LFA
Cisco-IOS-XR-segment-routing-ms-oper:srlb
Cisco-IOS-XR-segment-routing-ms-oper:srms
Mapping Server
Cisco-IOS-XR-mpls-ldp-oper:mpls-ldp/nodes/node/summary
Cisco-IOS-XR-mpls-ldp-oper:mpls-ldp/nodes/node/default-vrf/neighbors
LDP
Cisco-IOS-XR-infra-syslog-oper:syslog/messages/messageSyslog
Cisco-IOS-XR-wdsysmon-fd-oper:system-monitoring/cpu-utilizationCPU
Cisco-IOS-XR-nto-misc-oper:memory-summary/nodes/node/summaryMemory
Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface/total/interfaces-mib-countersIF-MIB
Cisco-IOS-XR-pfi-im-cmd-oper:interfaces/interface-xr/interfaceInterface
本文出自 Frank's Blog

版权声明:


本文链接:How To Get Telemetry sensor path for show cmd on IOS XR?
版权声明:本文为原创文章,仅代表个人观点,版权归 Frank Zhao 所有,转载时请注明本文出处及文章链接
你可以留言,或者trackback 从你的网站

3 Responses to “How To Get Telemetry sensor path for show cmd on IOS XR?”

  1. dandan说道:

    Hi Frank,

    About “How to get correct sensor path?”,
    I want to confirm one thing.

    XXXXXXXX-M-L2HE:661-yang xxxxxxxx$ pyang –format tree –tree-depth 6 [email protected] –tree-path /xtc/forwarding

    1.Where do I need to execute pyang’s command?
    2.It seems that you get the “[email protected]” from yangsuite, I can also get the oper path from the xr device, but it is slightly different from the name that appears on the yangsuite, this place can only enter the name viewed on the yangsuite, right?

  2. frank说道:

    1. You should download yang file from xr devices first or by yangsuit, then do the pyang in same directory, in my example, “661-yang”
    2. Yes, yangsuite will add timestamp, if you direct to download yang file from XR devices, should no the timestamp; whether to add timestamp depends on the name of your yang file。

留言哦

blonde teen swallows load.xxx videos