From ec4f4159dadfbebe008ba850389c38c3cc0b1cd5 Mon Sep 17 00:00:00 2001 From: damianoneill Date: Thu, 5 Jul 2018 12:46:41 +0100 Subject: [PATCH] Revert "#4 log the request and response payloads to the csv file for review" This reverts commit 959d943247286bc99638cc27adf8dcf8eaffa4a1. --- action/netconf.go | 21 ++++----------------- result/result.go | 2 -- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/action/netconf.go b/action/netconf.go index 6f5651b..27b033f 100644 --- a/action/netconf.go +++ b/action/netconf.go @@ -8,8 +8,6 @@ import ( "github.com/Juniper/go-netconf/netconf" "github.com/damianoneill/nc-hammer/result" "github.com/damianoneill/nc-hammer/suite" - "github.com/tdewolff/minify" - "github.com/tdewolff/minify/xml" "golang.org/x/crypto/ssh" ) @@ -58,7 +56,7 @@ func ExecuteNetconf(tsStart time.Time, cID int, action suite.Action, config *sui return } - xmlNetconf, err := action.Netconf.ToXMLString() + xml, err := action.Netconf.ToXMLString() if err != nil { fmt.Printf("E") result.Err = err.Error() @@ -66,10 +64,9 @@ func ExecuteNetconf(tsStart time.Time, cID int, action suite.Action, config *sui return } - raw := netconf.RawMethod(xmlNetconf) - result.Request = raw.MarshalMethod() + raw := netconf.RawMethod(xml) start := time.Now() - response, err := session.Exec(raw) + _, err = session.Exec(raw) if err != nil { if err.Error() == "WaitForFunc failed" { delete(gSessions, strconv.Itoa(cID)+config.Hostname+":"+strconv.Itoa(config.Port)) @@ -80,20 +77,10 @@ func ExecuteNetconf(tsStart time.Time, cID int, action suite.Action, config *sui return } elapsed := time.Since(start) + result.When = float64(time.Since(tsStart).Nanoseconds() / int64(time.Millisecond)) result.Latency = float64(elapsed.Nanoseconds() / int64(time.Millisecond)) - m := minify.New() - m.AddFunc("text/xml", xml.Minify) - minified, err := m.String("text/xml", response.RawReply) - if err != nil { - fmt.Printf("E") - result.Err = err.Error() - resultChannel <- result - return - } - result.Response = minified - resultChannel <- result } diff --git a/result/result.go b/result/result.go index 0f13ca3..aa39c5e 100644 --- a/result/result.go +++ b/result/result.go @@ -18,8 +18,6 @@ type NetconfResult struct { SessionID int Hostname string Operation string - Request string - Response string When float64 Err string Latency float64