Skip to content

Commit 51e6676

Browse files
authored
NETOBSERV-2009: network events to string (#135)
* NETOBSERV-2009: stringify network event * use released agent update vendors
1 parent f7c7888 commit 51e6676

File tree

156 files changed

+4141
-1890
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+4141
-1890
lines changed

cmd/flow_capture_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ func TestFlowTableAdvancedDisplay(t *testing.T) {
140140
// set display without enrichment
141141
rows := getRows(allOptions, []string{pktDropFeature, dnsFeature, rttFeature, networkEventsDisplay}, noOptions, []string{})
142142
assert.Equal(t, 4, len(rows))
143-
assert.Equal(t, `End Time Src IP Src Port Dst IP Dst Port Interfaces Interface Dirs Dropped Bytes Dropped Packets Drop State Drop Cause Drop Flags DNS Id DNS Latency DNS RCode DNS Error Flow RTT Network Events `, rows[0])
144-
assert.Equal(t, `17:25:28.703000 10.128.0.29 1234 10.129.0.26 5678 f18b970c2ce8fdd Egress 32B 1 TCP_INVALID_STATE SKB_DROP_REASON_TCP_INVALID_SEQUENCE 16 31319 1ms NoError 0 10µs hello `, rows[1])
145-
assert.Equal(t, `--------------- ---------- ---------- ---------- ---------- ---------- ---------- ----- ----- ---------- ---------- ---------- ----- ----- ----- ----- ----- --------------- `, rows[2])
143+
assert.Equal(t, `End Time Src IP Src Port Dst IP Dst Port Interfaces Interface Dirs Dropped Bytes Dropped Packets Drop State Drop Cause Drop Flags DNS Id DNS Latency DNS RCode DNS Error Flow RTT Network Events `, rows[0])
144+
assert.Equal(t, `17:25:28.703000 10.128.0.29 1234 10.129.0.26 5678 f18b970c2ce8fdd Egress 32B 1 TCP_INVALID_STATE SKB_DROP_REASON_TCP_INVALID_SEQUENCE 16 31319 1ms NoError 0 10µs Allowed by default allow from local node policy, direction Ingress `, rows[1])
145+
assert.Equal(t, `--------------- ---------- ---------- ---------- ---------- ---------- ---------- ----- ----- ---------- ---------- ---------- ----- ----- ----- ----- ----- --------------- `, rows[2])
146146
assert.Empty(t, rows[3])
147147

148148
// set display to standard
@@ -184,8 +184,8 @@ func TestFlowTableAdvancedDisplay(t *testing.T) {
184184
// set display to NetworkEvents
185185
rows = getRows("Network events", []string{networkEventsDisplay}, noOptions, []string{})
186186
assert.Equal(t, 4, len(rows))
187-
assert.Equal(t, `End Time Src IP Src Port Dst IP Dst Port Interfaces Interface Dirs Network Events `, rows[0])
188-
assert.Equal(t, `17:25:28.703000 10.128.0.29 1234 10.129.0.26 5678 f18b970c2ce8fdd Egress hello `, rows[1])
189-
assert.Equal(t, `--------------- ---------- ---------- ---------- ---------- ---------- ---------- --------------- `, rows[2])
187+
assert.Equal(t, `End Time Src IP Src Port Dst IP Dst Port Interfaces Interface Dirs Network Events `, rows[0])
188+
assert.Equal(t, `17:25:28.703000 10.128.0.29 1234 10.129.0.26 5678 f18b970c2ce8fdd Egress Allowed by default allow from local node policy, direction Ingress `, rows[1])
189+
assert.Equal(t, `--------------- ---------- ---------- ---------- ---------- ---------- ---------- --------------- `, rows[2])
190190
assert.Empty(t, rows[3])
191191
}

cmd/map_format.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
"github.com/jpillora/sizestr"
1111
"github.com/netobserv/flowlogs-pipeline/pkg/config"
12+
ovnutils "github.com/netobserv/netobserv-ebpf-agent/pkg/utils"
1213
)
1314

1415
const (
@@ -512,6 +513,9 @@ func ToTableRow(genericMap config.GenericMap, colIDs []string) []interface{} {
512513
row = append(row, toDuration(genericMap, fieldName, time.Millisecond))
513514
case "TimeFlowRttMs":
514515
row = append(row, toDuration(genericMap, fieldName, time.Nanosecond))
516+
case "NetworkEvents":
517+
events := ovnutils.NetworkEventsToStrings(genericMap)
518+
row = append(row, strings.Join(events, ", "))
515519
default:
516520
// else simply pick field value as text from column name
517521
row = append(row, toValue(genericMap, fieldName))

cmd/root_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const (
4444
"PktDropLatestFlags":16,
4545
"PktDropLatestState":"TCP_INVALID_STATE",
4646
"PktDropPackets":1,
47-
"NetworkEvents":["hello"],
47+
"NetworkEvents":[{"Feature":"acl","Type":"NetpolNode","Action":"allow","Direction":"Ingress"}],
4848
"Proto":6,
4949
"SrcAddr":"10.128.0.29",
5050
"SrcK8S_HostIP":"10.0.1.1",

go.mod

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ require (
1010
github.com/google/gopacket v1.1.19
1111
github.com/jpillora/sizestr v1.0.0
1212
github.com/mattn/go-sqlite3 v1.14.24
13-
github.com/netobserv/flowlogs-pipeline v1.7.0-community
13+
github.com/netobserv/flowlogs-pipeline v1.7.0-community.0.20241217113023-fa0540a1658e
14+
github.com/netobserv/netobserv-ebpf-agent v1.7.0-community.0.20250220123714-ff37a09f6232
1415
github.com/rodaine/table v1.3.0
1516
github.com/ryankurte/go-pcapng v0.0.0-20170712041429-73fd1a63fab4
1617
github.com/sirupsen/logrus v1.9.3
@@ -20,78 +21,75 @@ require (
2021
sigs.k8s.io/e2e-framework v0.6.0
2122
)
2223

23-
require (
24-
github.com/blang/semver/v4 v4.0.0 // indirect
25-
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
26-
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
27-
github.com/google/go-cmp v0.6.0 // indirect
28-
github.com/gorilla/websocket v1.5.0 // indirect
29-
github.com/klauspost/compress v1.17.9 // indirect
30-
github.com/moby/spdystream v0.5.0 // indirect
31-
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
32-
github.com/netobserv/netobserv-ebpf-agent v1.6.1-crc2.0.20241001154044-8c6c4c91c326 // indirect
33-
github.com/x448/float16 v0.8.4 // indirect
34-
go.opentelemetry.io/otel v1.29.0 // indirect
35-
go.opentelemetry.io/otel/trace v1.29.0 // indirect
36-
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
37-
k8s.io/component-base v0.32.1 // indirect
38-
sigs.k8s.io/controller-runtime v0.20.0 // indirect
39-
)
40-
4124
require (
4225
github.com/beorn7/perks v1.0.1 // indirect
26+
github.com/blang/semver/v4 v4.0.0 // indirect
4327
github.com/cespare/xxhash/v2 v2.3.0 // indirect
4428
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
45-
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
29+
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
30+
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
31+
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
4632
github.com/go-logr/logr v1.4.2 // indirect
4733
github.com/go-openapi/jsonpointer v0.21.0 // indirect
48-
github.com/go-openapi/jsonreference v0.20.2 // indirect
34+
github.com/go-openapi/jsonreference v0.21.0 // indirect
4935
github.com/go-openapi/swag v0.23.0 // indirect
5036
github.com/gogo/protobuf v1.3.2 // indirect
5137
github.com/golang/protobuf v1.5.4 // indirect
5238
github.com/google/gnostic-models v0.6.8 // indirect
39+
github.com/google/go-cmp v0.6.0 // indirect
5340
github.com/google/gofuzz v1.2.0 // indirect
5441
github.com/google/uuid v1.6.0 // indirect
42+
github.com/gorilla/websocket v1.5.0 // indirect
5543
github.com/inconshreveable/mousetrap v1.1.0 // indirect
5644
github.com/josharian/intern v1.0.0 // indirect
5745
github.com/jpillora/backoff v1.0.0 // indirect
5846
github.com/json-iterator/go v1.1.12 // indirect
47+
github.com/klauspost/compress v1.17.11 // indirect
5948
github.com/mailru/easyjson v0.7.7 // indirect
6049
github.com/mattn/go-colorable v0.1.13 // indirect
6150
github.com/mattn/go-isatty v0.0.20 // indirect
51+
github.com/moby/spdystream v0.5.0 // indirect
6252
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
6353
github.com/modern-go/reflect2 v1.0.2 // indirect
6454
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
6555
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
56+
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
57+
github.com/ovn-org/ovn-kubernetes/go-controller v0.0.0-20250215040159-dd2a70c928d3 // indirect
6658
github.com/pkg/errors v0.9.1 // indirect
6759
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
68-
github.com/prometheus/client_golang v1.20.3 // indirect
60+
github.com/prometheus/client_golang v1.20.5 // indirect
6961
github.com/prometheus/client_model v0.6.1 // indirect
70-
github.com/prometheus/common v0.55.0 // indirect
62+
github.com/prometheus/common v0.59.1 // indirect
7163
github.com/prometheus/procfs v0.15.1 // indirect
7264
github.com/segmentio/kafka-go v0.4.47 // indirect
7365
github.com/spf13/pflag v1.0.6 // indirect
7466
github.com/vladimirvivien/gexe v0.4.1
67+
github.com/x448/float16 v0.8.4 // indirect
7568
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
7669
github.com/xdg-go/scram v1.1.2 // indirect
7770
github.com/xdg-go/stringprep v1.0.4 // indirect
71+
go.opentelemetry.io/otel v1.32.0 // indirect
72+
go.opentelemetry.io/otel/trace v1.32.0 // indirect
7873
golang.org/x/net v0.33.0 // indirect
79-
golang.org/x/oauth2 v0.23.0 // indirect
80-
golang.org/x/sys v0.28.0 // indirect
74+
golang.org/x/oauth2 v0.24.0 // indirect
75+
golang.org/x/sys v0.30.0 // indirect
8176
golang.org/x/term v0.27.0 // indirect
8277
golang.org/x/text v0.21.0 // indirect
8378
golang.org/x/time v0.7.0 // indirect
84-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 // indirect
85-
google.golang.org/grpc v1.66.0 // indirect
79+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a // indirect
80+
google.golang.org/grpc v1.70.0 // indirect
8681
google.golang.org/protobuf v1.36.5
82+
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
8783
gopkg.in/inf.v0 v0.9.1 // indirect
8884
gopkg.in/yaml.v2 v2.4.0 // indirect
89-
k8s.io/api v0.32.1 // indirect
90-
k8s.io/apimachinery v0.32.1 // indirect
91-
k8s.io/client-go v0.32.1 // indirect
85+
k8s.io/api v0.32.2 // indirect
86+
k8s.io/apimachinery v0.32.2 // indirect
87+
k8s.io/client-go v0.32.2 // indirect
88+
k8s.io/component-base v0.32.1 // indirect
9289
k8s.io/klog/v2 v2.130.1 // indirect
9390
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
9491
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
92+
sigs.k8s.io/controller-runtime v0.20.0 // indirect
9593
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
9694
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
9795
sigs.k8s.io/yaml v1.4.0 // indirect

0 commit comments

Comments
 (0)