Skip to content

Commit

Permalink
Revert "#4 log the request and response payloads to the csv file for …
Browse files Browse the repository at this point in the history
…review"

This reverts commit 959d943.
  • Loading branch information
alrighttheresham committed Jul 5, 2018
1 parent 959d943 commit ec4f415
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
21 changes: 4 additions & 17 deletions action/netconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -58,18 +56,17 @@ 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()
resultChannel <- result
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))
Expand All @@ -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
}

Expand Down
2 changes: 0 additions & 2 deletions result/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ type NetconfResult struct {
SessionID int
Hostname string
Operation string
Request string
Response string
When float64
Err string
Latency float64
Expand Down

0 comments on commit ec4f415

Please sign in to comment.