Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC error "expecting </configuration>" returned on use of GetConfig #18

Open
radcool opened this issue Sep 12, 2016 · 10 comments
Open

RPC error "expecting </configuration>" returned on use of GetConfig #18

radcool opened this issue Sep 12, 2016 · 10 comments

Comments

@radcool
Copy link

radcool commented Sep 12, 2016

Hi,

Whenever I try to retrieve a Junos config using:

jnpr, err := junos.NewSession(hostname, username, password)
config, err := jnpr.GetConfig("", "text")

I always get this error: netconf rpc [error]: syntax error, expecting </configuration>.

This doesn't seem to be device-specific as I get the same error on SRX, MX and QFX.

Is this a know bug or simply an error on my part?

I used go get about a week ago so the go-junos code I'm using should be fairly recent.

Thanks,
-Martin

@scottdware
Copy link
Owner

It might be a bug. Thanks for catching this and I'll take a look at it!

@scottdware
Copy link
Owner

scottdware commented Sep 12, 2016

Actually, I see the problem. You have the parameters backwards. The "section" is supposed to be the second (optional) parameter. If you just specify the following:

config, err := jnpr.GetConfig("text")

Then you will get the entire config, vs something like:

config, err := jnpr.GetConfig("text", "interfaces")

I will have to work on the MX parsing, as it's not coming through as it should. Everything else should work ok - I tested it on a QFX, EX, and SRX.

@radcool
Copy link
Author

radcool commented Sep 13, 2016

OK, I think I know what might have happened. I stumbled upon your library from this blog entry. One of the examples on the page is the following:

routing, _ := jnpr.GetConfig("routing-instances", "text")  
fmt.Println(routing)

I just used that example as a start for my program and didn't double check with the GoDoc documentation. The RPC error returned wasn't obviously clear (to me), so it didn't dawn on me to double-check the docs to make sure I was using the function correctly.

Switching the argument order in my function call made it work, as you explained. Thanks for looking into it!

Do you need me to test anything with an MX?

Thanks,
-Martin

@scottdware
Copy link
Owner

Ah...forgot to update my blog when I changed the function parameters around :) Thanks a lot!

Yeah, if you wouldn't mind testing, that would be great. I spent just a couple minutes diving into it yesterday, and apparently the XML response on the "get-software-information" RPC call is different than that of the other platforms.

@radcool
Copy link
Author

radcool commented Sep 13, 2016

I tested using routing, err := jnpr.GetConfig("text") on an MX960 running 14.1R4.10 and was able to retrieve the config without any error. XML format retrieval also worked fine.

@scottdware
Copy link
Owner

Do you have dual routing engines?

@radcool
Copy link
Author

radcool commented Sep 14, 2016

Yes.

@scottdware
Copy link
Owner

I'm running 14.2R5.8 on our MX104's and get an error. Must be tied to the model. I'll dig into it more. Thanks for the continued effort!

@radcool
Copy link
Author

radcool commented Sep 15, 2016

My pleasure!

@daemus
Copy link
Contributor

daemus commented Dec 6, 2018

@scottdware if you can provide me with the sanitized XML output of the equivalent SSH command, and the error you get from go-junos, I can try to fix it. I don't have access to any dual-RE MX gear, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants