Skip to content

Commit bf49c73

Browse files
committed
Clarify test file name, use existing ipv6 const
1 parent ee60027 commit bf49c73

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

pkg/exporter/convert_flp.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"syscall"
55
"time"
66

7+
"github.com/mdlayher/ethernet"
78
"github.com/netobserv/flowlogs-pipeline/pkg/config"
89
"github.com/netobserv/netobserv-ebpf-agent/pkg/decode"
910
"github.com/netobserv/netobserv-ebpf-agent/pkg/flow"
@@ -37,7 +38,7 @@ func ConvertToFLP(fr *flow.Record) config.GenericMap {
3738
out["Packets"] = fr.Metrics.Packets
3839
}
3940

40-
if fr.Id.EthProtocol != flow.IPv4Type && fr.Id.EthProtocol != flow.IPv6Type {
41+
if fr.Id.EthProtocol != uint16(ethernet.EtherTypeIPv4) && fr.Id.EthProtocol != uint16(ethernet.EtherTypeIPv6) {
4142
// e.g. ARP
4243
return out
4344
}

pkg/exporter/convert_flp_test.go renamed to pkg/exporter/converters_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"google.golang.org/protobuf/proto"
1616
)
1717

18-
func TestConvertFLP(t *testing.T) {
18+
func TestConversions(t *testing.T) {
1919
decoder := decode.Protobuf{}
2020

2121
someTime := time.Now()
@@ -345,7 +345,7 @@ func TestConvertFLP(t *testing.T) {
345345
require.NoError(t, err)
346346
assert.Equalf(t, *tt.expected, outDirect, tt.name)
347347

348-
// Test pb conversion
348+
// Test protobuf conversion
349349
tmpPB := flowToPB(tt.flow)
350350
rawPB, err := proto.Marshal(tmpPB)
351351
require.NoError(t, err)

pkg/flow/record.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const (
1818
const MacLen = 6
1919

2020
// IPv4Type / IPv6Type value as defined in IEEE 802: https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml
21-
const IPv4Type = 0x0800
2221
const IPv6Type = 0x86DD
2322

2423
type HumanBytes uint64

0 commit comments

Comments
 (0)