YANG , Telemetry sensor path

191 Views Asked by At

i am using this module " Cisco-IOS-XR-pfi-im-cmd-oper.yang" to get interface counts (UP , Down , Admin-Down), but i am stuck with symbol *[] , i dont understand what to put inside if there is no keys inside list brackets ,

 +--ro node-type-sets
 |  +--ro node-type-set* []
 |     +--ro node-name?           xr:Node-id
 |     +--ro type-set-name?       Interface-type-set
 |     +--ro interface-summary
 |        +--ro interface-counts
 |        |  +--ro interface-count?              uint32
 |        |  +--ro up-interface-count?           uint32
 |        |  +--ro down-interface-count?         uint32
 |        |  +--ro admin-down-interface-count?   uint32
 |        +--ro interface-type* []
 |           +--ro interface-counts
 |           |  +--ro interface-count?              uint32
 |           |  +--ro up-interface-count?           uint32
 |           |  +--ro down-interface-count?         uint32
 |           |  +--ro admin-down-interface-count?   uint32
 |           +--ro interface-type-name?          string
 |           +--ro interface-type-description?   string 

i figure out this path below , but it still keep tell me is worng

Cisco-IOS-XR-pfi-im-cmd-oper:interfaces/node-type-sets/node-type-set[type-set-name='hardware-interfaces',node-name='0/RP0/CPU0']/interface-summary/interface-type[interface-type-name='IFT_GETHERNET',interface-type-description='GigabitEthernet']/interface-counts

i want to get "interface-counts" when the :

type-set-name='hardware-interfaces' 
node-name='0/RP0/CPU0' 
interface-type-name='IFT_GETHERNET' 
interface-type-description='GigabitEthernet' 

all these info to get specific interface counts for this module

1

There are 1 best solutions below

1
predi On

It is unclear what context your path is used in, but I'm assuming you need an instance identifier.

If you need to uniquely identify an instance that is a list without keys or has list ancestors without keys (config false data nodes), you need to follow RFC 7950, Section 9.13..

The syntax for an instance-identifier is a subset of the XPath abbreviated syntax, formally defined by the rule "instance-identifier" in Section 14. It is used to uniquely identify a node in the data tree. Predicates are used only for specifying the values for the key nodes for list entries, a value of a leaf-list entry, or a positional index for a list without keys. For identifying list entries with keys, each predicate consists of one equality test per key, and each key MUST have a corresponding predicate. If a key is of type "empty", it is represented as a zero-length string ("").

There's an example in Section 9.13.4:

     /* instance-identifier for a list entry without keys */
     /ex:stats/ex:port[3]