Skip to content

How to parse Netconf response and print certain values like a Python f-string to stdout #128

Closed Answered by bruckynetworkstest
bruckynetworkstest asked this question in Q&A
Discussion options

You must be logged in to vote

Typically as soon as you write the post, you can find the answer.

I can parse certain values and print them out now successfully.

Here is the script I am using for this.

package main

import (
	"fmt"
	"strings"

	"github.com/antchfx/xmlquery"
	"github.com/scrapli/scrapligo/driver/netconf"
	"github.com/scrapli/scrapligo/driver/options"
)

func main() {
	// Set the device IP address
	deviceIP := "x.x.x.x"

	d, err := netconf.NewDriver(
		deviceIP,
		options.WithAuthNoStrictKey(),
		options.WithAuthUsername("xxxx"),
		options.WithAuthPassword("xxxx"),
		options.WithPort(830),
	)
	if err != nil {
		fmt.Printf("failed to create driver; error: %+v\n", err)
		return
	}

	err = d.Open()
	if err !…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bruckynetworkstest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant