syntax error during load

540 views
Skip to first unread message

Elisa Jasinska

unread,
Aug 8, 2016, 1:40:04 PM8/8/16
to junos-p...@googlegroups.com
Hey, quick question… 

I am trying to track down why the rpc error upon a config load doesn’t include more detailed information on syntax errors. One the cli I get line number, even column… 

# load replace candidate.conf | display xml
    <load-configuration-results>
        <rpc>
            <file>
                <send-file>
                    <source-filename>candidate.conf</source-filename>
                    <alias-filename>candidate.conf</alias-filename>
                    <display-spinner/>
                </send-file>
            </file>
        </rpc>
            <filename>candidate.conf</filename>
            <line-number>1934</line-number>
            <column>17</column>
            <token>login</token>
            <message>syntax error</message>
        </xnm:error>
        <output>  [edit groups system]
        </output>
        <output>    'login {'
                  syntax error
        </output>

Where the rpc error for this only includes:

<rpc-error xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/15.1X53/junos" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<error-type>protocol</error-type>
<error-tag>operation-failed</error-tag>
<error-severity>error</error-severity>
<error-message>error recovery ignores input until this point</error-message>
<error-info>
<bad-element>}</bad-element>
</error-info>
</rpc-error>

Is this something juniper or netconf related? Or are the reply details eaten somewhere by pyez because the error is raised? 

Thanks!
Elisa

--
Elisa Jasińska

Mircea Ulinic

unread,
Aug 8, 2016, 7:50:16 PM8/8/16
to Junos Python EZ
Hi Elisa,

The rpc-error you provided respects the format as specified in RFC 6241, paragraph 4.3.

Looking into the logs when trying to load a config with more curly brackets than necessary (as we can deduce from your example above), the device returns:

Aug  8 23:26:45 [74663] Incoming: <?xml version="1.0" encoding="UTF-8"?><nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:9228a554-5dbf-11e6-af59-2c600c83f6e9"><load-configuration action="replace" format="text"><configuration-text>system { ntp { peer {172.17.17.1; } }</configuration-text></load-configuration></nc:rpc>]]>]]>
Aug  8 23:26:45 [74663] Outgoing: <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/13.3R6/junos" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:9228a554-5dbf-11e6-af59-2c600c83f6e9">
Aug  8 23:26:45 [74663] Outgoing: <load-configuration-results>
Aug  8 23:26:45 [74663] Outgoing: <rpc-error>
Aug  8 23:26:45 [74663] Outgoing: <error-type>protocol</error-type>
Aug  8 23:26:45 [74663] Outgoing: <error-tag>operation-failed</error-tag>
Aug  8 23:26:45 [74663] Outgoing: <error-severity>error</error-severity>
Aug  8 23:26:45 [74663] Outgoing: <error-message>syntax error, expecting &lt;identifier&gt;</error-message>
Aug  8 23:26:45 [74663] Outgoing: <error-info>
Aug  8 23:26:45 [74663] Outgoing: <bad-element>{</bad-element>
Aug  8 23:26:45 [74663] Outgoing: </error-info>
Aug  8 23:26:45 [74663] Outgoing: </rpc-error>
Aug  8 23:26:45 [74663] Outgoing: <rpc-error>
Aug  8 23:26:45 [74663] Outgoing: <error-severity>warning</error-severity>
Aug  8 23:26:45 [74663] Outgoing: <error-message>mgd: statement must contain additional statements</error-message>
Aug  8 23:26:45 [74663] Outgoing: </rpc-error>
Aug  8 23:26:45 [74663] Outgoing: </load-configuration-results>
Aug  8 23:26:45 [74663] Outgoing: </rpc-reply>
Aug  8 23:26:45 [74663] Outgoing: ]]>]]>

That means the output returned by Junos does not contain the details you expected.

Consulting Appendix A from the same RFC, can see that the list of options is pretty small and does not allow inserting bunch of details like column, line, filename etc...

But you can open a JTAC :)

Cheers,
Mircea

Elisa Jasinska

unread,
Aug 9, 2016, 5:49:08 AM8/9/16
to Mircea Ulinic, Junos Python EZ
Ok, so this is netconf related then, as junos itself seems to have more details. A way of exposing them within the standard might be concat-ing the info to the ‘<error-message>’ portion, but yeah…. that would be a jtac thing to look at… too bad.

Thanks!
Elisa

--
You received this message because you are subscribed to the Google Groups "Junos Python EZ" group.
To unsubscribe from this group and stop receiving emails from it, send an email to junos-python-ez+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/junos-python-ez.
To view this discussion on the web visit https://groups.google.com/d/msgid/junos-python-ez/94ee8cd4-0253-463b-a3d8-cc4b23660929%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages