Skip to content

Commit

Permalink
Add source_type
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreYang committed Jan 20, 2023
1 parent a55863d commit d43e943
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions pkg/collector/corechecks/snmp/internal/metadata/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ type TopologyLinkSide struct {

// TopologyLinkMetadata contains topology interface to interface links metadata
type TopologyLinkMetadata struct {
ID string `json:"id"`
Local *TopologyLinkSide `json:"local"`
Remote *TopologyLinkSide `json:"remote"`
ID string `json:"id"`
SourceType string `json:"source_type"`
Local *TopologyLinkSide `json:"local"`
Remote *TopologyLinkSide `json:"remote"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
)

const interfaceStatusMetric = "snmp.interface.status"
const topologyLinkSourceTypeLLDP = "lldp"

// ReportNetworkDeviceMetadata reports device metadata
func (ms *MetricSender) ReportNetworkDeviceMetadata(config *checkconfig.CheckConfig, store *valuestore.ResultValueStore, origTags []string, collectTime time.Time, deviceStatus metadata.DeviceStatus) {
Expand Down Expand Up @@ -311,7 +312,8 @@ func buildNetworkTopologyMetadata(deviceID string, store *metadata.Store, interf
remEntryUniqueID := localPortNum + "." + lldpRemIndex

newLink := metadata.TopologyLinkMetadata{
ID: deviceID + ":" + remEntryUniqueID,
ID: deviceID + ":" + remEntryUniqueID,
SourceType: topologyLinkSourceTypeLLDP,
Remote: &metadata.TopologyLinkSide{
Device: &metadata.TopologyLinkDevice{
Name: store.GetColumnAsString("lldp_remote.device_name", strIndex),
Expand Down
2 changes: 2 additions & 0 deletions pkg/collector/corechecks/snmp/profile_metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ profiles:
"links": [
{
"id": "profile-metadata:1.2.3.4:101.1",
"source_type": "lldp",
"local": {
"device": {
"id": "profile-metadata:1.2.3.4",
Expand Down Expand Up @@ -592,6 +593,7 @@ profiles:
},
{
"id": "profile-metadata:1.2.3.4:102.2",
"source_type": "lldp",
"local": {
"device": {
"id": "profile-metadata:1.2.3.4",
Expand Down

0 comments on commit d43e943

Please sign in to comment.