Closed utterances-bot closed 2 years ago
Hi Roman, Thanks for the post! Do you know by any chance if all this is supported with latest go versions (e.g. go1.17.5) ? Personally got errors when trying to apply your scripts in:
netconf.go: package command-line-arguments imports github.com/antchfx/xmlquery imports github.com/antchfx/xmlquery: import cycle not allowed (I don't see any import cycle in there unless xmlquery loops over itself..)
main_fsm.go: ./main_fsm.go:14:25: cannot use base.WithAuthStrictKey(false) (type base.Option) as type string in argument to core.NewCoreDriver
Regards, Thomas.
Hi @thcorre,
the examples still work with 1.17. Maybe you need to do go mod tidy
to clean your dependency tree.
Here is the go.mod file contents for the netconf example:
module example1
go 1.17
require (
github.com/antchfx/xmlquery v1.3.9
github.com/scrapli/scrapligo v0.1.2
)
require (
github.com/antchfx/xpath v1.2.0 // indirect
github.com/creack/pty v1.1.11 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/sirikothe/gotextfsm v1.0.0 // indirect
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b // indirect
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect
golang.org/x/text v0.3.3 // indirect
)
Thx @hellt, netconf.go is indeed working after changing the go.mod file content with the one you've shared + doing go mod tidy.
As for the main_fsm.go, seems a second node (string type) argument is expected. Still got errors but will further check.
I am getting errors taking the last code snippet and changing the "NewCoreDriver" interface to match what I have.
Mostly surrounding
parsedOut, err := r.TextFsmParse("./templates/cisco_ios_show_version.textfsm")
I am getting "Panic runtime error, invalid memory address or nil pointer dereference"
Network automation options in Go with scrapligo |
https://netdevops.me/2021/network-automation-options-in-go-with-scrapligo/