XPath Formatting Rules for gnmic Subscription

OcNOS enforces specific formatting rules for XPath in gNMIc subscription commands.

1. String Key Formatting: Xpath with string keys must be enclosed in double quotes ("").

Example:

Copy
--path '/components/component[name="TEMPERATURE-MAC"]/state'

--path /components/component[name=\"TEMPERATURE-MAC\"]/state
2. Integer Key Formatting: Xpath with integer keys must be provided without double quotes.

Example:

Copy
--path ipi:/bgp/bgp-instances/bgp-instance[bgp-as=100]/peers/peer[peer-address=\"1.1.1.1\"]/state

--path  'ipi:/bgp/bgp-instances/bgp-instance[bgp-as=100]/peers/peer[peer-address="1.1.1.1"]/state'
3. Implicit Wildcard Keys: Xpath with implicit wildcard keys can be provided with or without single quotes.

Example:

Copy
--path '/components/component/state'

--path /components/component/state
4. Key Order in Sensor Paths: When using multiple keys in sensor paths, key-value pairs must be configured in the same order as defined by the IPI data model sensor path list. Incorrect ordering may cause subscription failures or unexpected behavior in telemetry data collection.

Example: Incorrect Order (Invalid Configuration)

In this example, "vrf-name" appears before "local-discriminator", which does not match the expected order.

Copy
ipi:/bfd/sessions/session[vrf-name="default"][local-discriminator="2050"]/state/counters/packets/ipv4

Example: Correct Order (Valid Configuration)

In this example, "vrf-name" appears after "local-discriminator", which matches the expected order.

Copy
ipi:/bfd/sessions/session[local-discriminator="2050"][vrf-name="default"]/state/counters/packets/ipv4