Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions src/go/pkg/l2topology/engine.go

This file was deleted.

22 changes: 0 additions & 22 deletions src/go/pkg/l2topology/engine_test.go

This file was deleted.

4 changes: 2 additions & 2 deletions src/go/pkg/l2topology/l2_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package l2topology

import "fmt"
import "errors"

const (
fdbStatusLearned = "learned"
Expand All @@ -15,7 +15,7 @@ const (
// DiscoverOptions.CollectedAt explicitly.
func BuildL2ResultFromObservations(observations []L2Observation, opts DiscoverOptions) (Result, error) {
if len(observations) == 0 {
return Result{}, fmt.Errorf("%w: at least one observation is required", ErrInvalidRequest)
return Result{}, errors.New("at least one observation is required")
}
if !opts.EnableLLDP && !opts.EnableCDP && !opts.EnableBridge && !opts.EnableARP && !opts.EnableSTP {
opts.EnableLLDP = true
Expand Down
1 change: 0 additions & 1 deletion src/go/pkg/l2topology/l2_pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,6 @@ func TestBuildL2ResultFromObservations_AnnotatesPairMetadata(t *testing.T) {
func TestBuildL2ResultFromObservations_ErrorsOnEmptyInput(t *testing.T) {
_, err := BuildL2ResultFromObservations(nil, DiscoverOptions{EnableLLDP: true})
require.Error(t, err)
require.ErrorIs(t, err, ErrInvalidRequest)
}

func findDeviceByHostname(devices []Device, hostname string) *Device {
Expand Down
4 changes: 3 additions & 1 deletion src/go/pkg/l2topology/mac_oui_lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"sort"
"strings"
"sync"

"github.com/netdata/netdata/go/plugins/pkg/topology/graph"
)

//go:embed mac_oui_vendors.tsv
Expand Down Expand Up @@ -114,7 +116,7 @@ func lookupTopologyVendorByMACInIndex(index topologyOUIVendorIndex, mac string)
return "", ""
}

func inferTopologyVendorFromMatch(match Match) (vendor string, prefix string) {
func inferTopologyVendorFromMatch(match graph.Match) (vendor string, prefix string) {
candidates := make(map[string]struct{}, len(match.MacAddresses)+len(match.ChassisIDs))
for _, value := range match.MacAddresses {
if mac := normalizeMAC(value); mac != "" {
Expand Down
6 changes: 4 additions & 2 deletions src/go/pkg/l2topology/mac_oui_lookup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
package l2topology

import (
"github.com/stretchr/testify/require"
"strings"
"testing"

"github.com/netdata/netdata/go/plugins/pkg/topology/graph"
"github.com/stretchr/testify/require"
)

func TestBuildTopologyOUIVendorIndex_IgnoresInvalidLinesAndKeepsFirstDuplicate(t *testing.T) {
Expand Down Expand Up @@ -47,7 +49,7 @@ func TestLookupTopologyVendorByMACInIndex_PrefersLongestPrefixAndNormalizesMAC(t
}

func TestInferTopologyVendorFromMatch_UsesDeterministicCandidateOrder(t *testing.T) {
match := Match{
match := graph.Match{
MacAddresses: []string{
"28:6f:b9:00:00:22",
"08:ea:44:11:22:33",
Expand Down
35 changes: 0 additions & 35 deletions src/go/pkg/l2topology/node_topology.go

This file was deleted.

Loading
Loading