fix(inputs.gnmi): Normalize path for inline origin handling (#14838)

This commit is contained in:
Sven Rebhan 2024-02-20 15:01:52 +01:00 committed by GitHub
parent e490983fe1
commit 8a838634c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 64 additions and 0 deletions

View File

@ -141,6 +141,7 @@ func (pi *pathInfo) append(paths ...*gnmiLib.Path) *pathInfo {
path.keyValues = append(path.keyValues, keyInfo)
}
}
path.normalize()
return path
}
@ -172,6 +173,7 @@ func (pi *pathInfo) appendSegments(segments ...string) *pathInfo {
}
path.segments = append(path.segments, s)
}
path.normalize()
return path
}

View File

@ -0,0 +1,2 @@
interfaces-counter,name=AppGigabitEthernet1/0/1,source=127.0.0.1 discontinuity_time="2023-11-15T05:50:40+00:00" 1708069483623763000
interfaces-counter,name=FortyGigabitEthernet1/1/1,source=127.0.0.1 discontinuity_time="2023-11-15T05:50:40+00:00" 1708069483623763000

View File

@ -0,0 +1,51 @@
[
{
"update": {
"timestamp": "1708069483623763000",
"update": [
{
"path": {
"elem": [
{
"name": "Cisco-IOS-XE-interfaces-oper:interfaces"
},
{
"name": "interface",
"key": {
"name": "AppGigabitEthernet1/0/1"
}
},
{
"name": "statistics"
}
]
},
"val": {
"jsonIetfVal": "eyJkaXNjb250aW51aXR5LXRpbWUiOiIyMDIzLTExLTE1VDA1OjUwOjQwKzAwOjAwIn0K"
}
},
{
"path": {
"elem": [
{
"name": "Cisco-IOS-XE-interfaces-oper:interfaces"
},
{
"name": "interface",
"key": {
"name": "FortyGigabitEthernet1/1/1"
}
},
{
"name": "statistics"
}
]
},
"val": {
"jsonIetfVal": "eyJkaXNjb250aW51aXR5LXRpbWUiOiIyMDIzLTExLTE1VDA1OjUwOjQwKzAwOjAwIn0K"
}
}
]
}
}
]

View File

@ -0,0 +1,9 @@
[[inputs.gnmi]]
addresses = ["dummy"]
[[inputs.gnmi.subscription]]
name = "interfaces-counter"
origin = "rfc7951"
path = "/Cisco-IOS-XE-interfaces-oper:interfaces/interface/statistics"
subscription_mode = "sample"
sample_interval = "5s"