Skip to content

Commit

Permalink
[NDM] [snmp] Add integration field for TopologyLinkMetadata (#30919)
Browse files Browse the repository at this point in the history
Co-authored-by: cecilia saixue watt <[email protected]>
  • Loading branch information
zoedt and cswatt authored Dec 19, 2024
1 parent 88a7672 commit f5d99e9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
6 changes: 6 additions & 0 deletions pkg/collector/corechecks/snmp/integration_topology_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ profiles:
{
"id": "profile-metadata:1.2.3.4:101.1",
"source_type": "lldp",
"integration": "snmp",
"local": {
"device": {
"dd_id": "profile-metadata:1.2.3.4"
Expand Down Expand Up @@ -689,6 +690,7 @@ profiles:
{
"id": "profile-metadata:1.2.3.4:102.2",
"source_type": "lldp",
"integration": "snmp",
"local": {
"device": {
"dd_id": "profile-metadata:1.2.3.4"
Expand Down Expand Up @@ -1363,6 +1365,7 @@ profiles:
{
"id": "profile-metadata:1.2.3.4:1.5",
"source_type": "cdp",
"integration": "snmp",
"local": {
"device": {
"dd_id": "profile-metadata:1.2.3.4"
Expand All @@ -1386,6 +1389,7 @@ profiles:
{
"id": "profile-metadata:1.2.3.4:2.3",
"source_type": "cdp",
"integration": "snmp",
"local": {
"device": {
"dd_id": "profile-metadata:1.2.3.4"
Expand Down Expand Up @@ -2056,6 +2060,7 @@ profiles:
{
"id": "profile-metadata:1.2.3.4:101.1",
"source_type": "lldp",
"integration": "snmp",
"local": {
"device": {
"dd_id": "profile-metadata:1.2.3.4"
Expand Down Expand Up @@ -2084,6 +2089,7 @@ profiles:
{
"id": "profile-metadata:1.2.3.4:102.2",
"source_type": "lldp",
"integration": "snmp",
"local": {
"device": {
"dd_id": "profile-metadata:1.2.3.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,9 @@ func buildNetworkTopologyMetadataWithLLDP(deviceID string, store *metadata.Store
remEntryUniqueID := localPortNum + "." + lldpRemIndex

newLink := devicemetadata.TopologyLinkMetadata{
ID: deviceID + ":" + remEntryUniqueID,
SourceType: topologyLinkSourceTypeLLDP,
ID: deviceID + ":" + remEntryUniqueID,
SourceType: topologyLinkSourceTypeLLDP,
Integration: common.SnmpIntegrationName,
Remote: &devicemetadata.TopologyLinkSide{
Device: &devicemetadata.TopologyLinkDevice{
Name: store.GetColumnAsString("lldp_remote.device_name", strIndex),
Expand Down Expand Up @@ -446,8 +447,9 @@ func buildNetworkTopologyMetadataWithCDP(deviceID string, store *metadata.Store,
remEntryUniqueID := cdpCacheIfIndex + "." + cdpCacheDeviceIndex

newLink := devicemetadata.TopologyLinkMetadata{
ID: deviceID + ":" + remEntryUniqueID,
SourceType: topologyLinkSourceTypeCDP,
ID: deviceID + ":" + remEntryUniqueID,
SourceType: topologyLinkSourceTypeCDP,
Integration: common.SnmpIntegrationName,
Remote: &devicemetadata.TopologyLinkSide{
Device: &devicemetadata.TopologyLinkDevice{
Name: store.GetColumnAsString("cdp_remote.device_name", strIndex),
Expand Down
9 changes: 5 additions & 4 deletions pkg/networkdevice/metadata/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ type TopologyLinkSide struct {

// TopologyLinkMetadata contains topology interface to interface links metadata
type TopologyLinkMetadata struct {
ID string `json:"id"`
SourceType string `json:"source_type"`
Local *TopologyLinkSide `json:"local"`
Remote *TopologyLinkSide `json:"remote"`
ID string `json:"id"`
SourceType string `json:"source_type"`
Integration string `json:"integration,omitempty"`
Local *TopologyLinkSide `json:"local"`
Remote *TopologyLinkSide `json:"remote"`
}

// NetflowExporter contains netflow exporters info
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Each section from every release note are combined when the
# CHANGELOG.rst is rendered. So the text needs to be worded so that
# it does not depend on any information only available in another
# section. This may mean repeating some details, but each section
# must be readable independently of the other.
#
# Each section note must be formatted as reStructuredText.
---
enhancements:
- |
Emit new field: integration for TopologyLinkMetadata for better metrics collection.

0 comments on commit f5d99e9

Please sign in to comment.