aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/infra/vppinstance.go
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2024-09-20 10:44:08 +0200
committerMatus Fabian <matfabia@cisco.com>2024-09-20 10:44:08 +0200
commit147585e7f6566fe08aa1cc774e7435660ab29e26 (patch)
tree47343a585e43700ab9c4cb461cddfc9715bd8c8f /extras/hs-test/infra/vppinstance.go
parent2fb8d2f96d9df0657d21b411d9cc803c0e994530 (diff)
hs-test: debugging utility methods
Type: test Change-Id: I0c7e8424e53f1ad1896cd8439027e6081ccfeb28 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'extras/hs-test/infra/vppinstance.go')
-rw-r--r--extras/hs-test/infra/vppinstance.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/extras/hs-test/infra/vppinstance.go b/extras/hs-test/infra/vppinstance.go
index a93921ed5be..b3ae995870f 100644
--- a/extras/hs-test/infra/vppinstance.go
+++ b/extras/hs-test/infra/vppinstance.go
@@ -619,3 +619,28 @@ func (vpp *VppInstance) MemLeakCheck(first, second []VppMemTrace) {
summary := fmt.Sprintf("\nSUMMARY: %d byte(s) leaked in %d allocation(s)\n", totalBytes, totalCounts)
AddReportEntry(summary, report)
}
+
+// CollectEventLogs saves event logs to the test execution directory
+func (vpp *VppInstance) CollectEventLogs() {
+ vpp.getSuite().Log(vpp.Vppctl("event-logger save event_log"))
+ targetDir := vpp.Container.Suite.getLogDirPath()
+ err := vpp.Container.GetFile("/tmp/event_log", targetDir+"/"+vpp.Container.Name+"-event_log")
+ if err != nil {
+ vpp.getSuite().Log(fmt.Sprint(err))
+ }
+}
+
+// EnablePcapTrace enables packet capture on all interfaces and maximum 10000 packets
+func (vpp *VppInstance) EnablePcapTrace() {
+ vpp.getSuite().Log(vpp.Vppctl("pcap trace rx tx max 10000 intfc any file vppTest.pcap"))
+}
+
+// CollectPcapTrace saves pcap trace to the test execution directory
+func (vpp *VppInstance) CollectPcapTrace() {
+ vpp.getSuite().Log(vpp.Vppctl("pcap trace off"))
+ targetDir := vpp.Container.Suite.getLogDirPath()
+ err := vpp.Container.GetFile("/tmp/vppTest.pcap", targetDir+"/"+vpp.Container.Name+".pcap")
+ if err != nil {
+ vpp.getSuite().Log(fmt.Sprint(err))
+ }
+}