diff --git a/pkg/collector/corechecks/snmp/integration_topology_test.go b/pkg/collector/corechecks/snmp/integration_topology_test.go index b4f0f42ceb6d0..c9298738ccf56 100644 --- a/pkg/collector/corechecks/snmp/integration_topology_test.go +++ b/pkg/collector/corechecks/snmp/integration_topology_test.go @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" diff --git a/pkg/collector/corechecks/snmp/internal/report/report_device_metadata.go b/pkg/collector/corechecks/snmp/internal/report/report_device_metadata.go index 3e9ad39677d4c..6bdcec852a1d8 100644 --- a/pkg/collector/corechecks/snmp/internal/report/report_device_metadata.go +++ b/pkg/collector/corechecks/snmp/internal/report/report_device_metadata.go @@ -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), @@ -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), diff --git a/pkg/networkdevice/metadata/payload.go b/pkg/networkdevice/metadata/payload.go index 54b2f45eb0996..5f67824728cbe 100644 --- a/pkg/networkdevice/metadata/payload.go +++ b/pkg/networkdevice/metadata/payload.go @@ -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 diff --git a/releasenotes/notes/add-integration-field-to-topology-link-metadata-8a35c0a70ac80b1e.yaml b/releasenotes/notes/add-integration-field-to-topology-link-metadata-8a35c0a70ac80b1e.yaml new file mode 100644 index 0000000000000..003ca577e3799 --- /dev/null +++ b/releasenotes/notes/add-integration-field-to-topology-link-metadata-8a35c0a70ac80b1e.yaml @@ -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. +