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

Add instructions on how to update parser #17

Merged
merged 2 commits into from
Apr 25, 2020

Conversation

vincentbernat
Copy link
Contributor

Also include the schema for JunOS 18.1R3-S9. It seems the schema is
not equipment specific as we only specify a version on Juniper
website.

Fix #16

@vincentbernat vincentbernat force-pushed the feature/update-parser branch 2 times, most recently from f9de4ee to 7df380f Compare March 25, 2020 19:25
@codeout
Copy link
Owner

codeout commented Apr 4, 2020

Thank you for your great documentation!

I didn't know that .xsd is available on https://support.juniper.net/support/downloads/. How different is it from that you can get by NETCONF?

I usually download .xsd from JUNOS device by NETCONF as you did at #16, but I'm also afraid it can be platform specific. If schema from Juniper web looks more generic, it should be better for this project.

README.md Outdated Show resolved Hide resolved
@vincentbernat
Copy link
Contributor Author

The ones I got from netconf didn't have the namespaces and it seemed that nokogiri is therefore confused. Did you get your XML schema with the same client as I show in #16? If it's possible to download directly from the equipment, I think this would be easier. Juniper is difficult when giving access to downloads. For some reason, I was authorized on my personal account, but not with the shared team account.

Also include the schema for JunOS 18.1R3-S9. It seems the schema is
not equipment specific as we only specify a version on Juniper
website.

Fix codeout#16
@vincentbernat vincentbernat force-pushed the feature/update-parser branch from 7df380f to a34ceca Compare April 4, 2020 12:30
@codeout
Copy link
Owner

codeout commented Apr 4, 2020

ssh + awk works for me.

ssh -sp 830 YOUR_JUNOS netconf < get-schema.xml | awk 'BEGIN{p=0}/<xsd:schema/{p=1}p{print;}/<\/xsd:schema/{p=0;}' > junos-system.xsd
# get-schema.xml

<?xml version="1.0" encoding="UTF-8"?>
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <capabilities>
    <capability>urn:ietf:params:netconf:base:1.0</capability>
  </capabilities>
</hello>
]]>]]>
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <get-xnm-information>
    <type>xml-schema</type>
    <namespace>junos-configuration</namespace>
  </get-xnm-information>
</rpc>
]]>]]>
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
  <close-session/>
</rpc>

@vincentbernat
Copy link
Contributor Author

vincentbernat commented Apr 4, 2020

I have tried your method and there are many differences. Additions and deletions. So, it's a bit unknown what Juniper provides on its website. I have added a commit to explain your method as well. For some reason, in my case, the generated parser.rb doesn't parse correctly (syntax error, unexpected end-of-input, expecting 'end'). I'll try to investigate a bit.

Edit: that's because of #18.

@codeout
Copy link
Owner

codeout commented Apr 4, 2020

Is the parser.rb generated from example/junos-18.1R3-S9.rb in your topic branch?
I'd like to reproduce it to get the point of #18.

@vincentbernat
Copy link
Contributor Author

It is, but I have already fixed the issue. It's easy to reproduce from any XSD. Just spot a xsd:documentation tag and add a new line somewhere in its content. In mine, I have:

        <!-- </connectivity-association> -->
        <xsd:element name="aes-gcm-revert-flag" minOccurs="0">
          <xsd:annotation>
            <xsd:documentation>Flag to fall back to previous AES_GCM_256
           cipher suite implementation</xsd:documentation>
            <xsd:appinfo>
              <flag>current-product-support</flag>
            </xsd:appinfo>
          </xsd:annotation>
          <xsd:complexType/>
        </xsd:element>

@codeout
Copy link
Owner

codeout commented Apr 8, 2020

Thanks, I could reproduce the problem. Let me look into it.

@codeout
Copy link
Owner

codeout commented Apr 25, 2020

I have confirmed that #18 fixes the problem. Thanks!

@codeout codeout merged commit c894937 into codeout:master Apr 25, 2020
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

Successfully merging this pull request may close these issues.

Documentation on updating the schema
2 participants