Skip to content

Commit

Permalink
Clarify test file name, use existing ipv6 const
Browse files Browse the repository at this point in the history
  • Loading branch information
jotak committed Nov 22, 2023
1 parent bcccbb7 commit 2be7d31
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pkg/exporter/convert_flp.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"syscall"
"time"

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

if fr.Id.EthProtocol != flow.IPv4Type && fr.Id.EthProtocol != flow.IPv6Type {
if fr.Id.EthProtocol != uint16(ethernet.EtherTypeIPv4) && fr.Id.EthProtocol != uint16(ethernet.EtherTypeIPv6) {
// e.g. ARP
return out
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"google.golang.org/protobuf/proto"
)

func TestConvertFLP(t *testing.T) {
func TestConversions(t *testing.T) {
decoder := decode.Protobuf{}

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

// Test pb conversion
// Test protobuf conversion
tmpPB := flowToPB(tt.flow)
rawPB, err := proto.Marshal(tmpPB)
require.NoError(t, err)
Expand Down
1 change: 0 additions & 1 deletion pkg/flow/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const (
const MacLen = 6

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

type HumanBytes uint64
Expand Down

0 comments on commit 2be7d31

Please sign in to comment.