Skip to content

apply-path takes a quoted string #22

Open

Description

@vincentbernat

Hey!

With the latest master, I still have issues with apply-path:

set policy-options prefix-list ipvX-bgp-neighbors apply-path "routing-instances <*> protocols bgp group <*> neighbor <*>"

Generated parser is:

            b(str("policy-options"),
                c(
                    b(a(str("prefix-list"), arg),
                        c(
                              prefix_list_items,
                            a(str("apply-path"), arg)
                        )
                    )
                )
            ),

Last arg could be replaced by quote.

XML says:

                  <xsd:element name="apply-path" minOccurs="0" type="xsd:string">
                    <xsd:annotation>
                      <xsd:documentation>Apply IP prefixes from a configuration statement</xsd:documentation>
                      <xsd:appinfo>
                        <flag>ephemeral-db-exclude</flag>
                        <flag>twig-dynamic-db-ok</flag>
                        <flag>current-product-support</flag>
                      </xsd:appinfo>
                    </xsd:annotation>
                  </xsd:element>

To me, it seems when we have an xsd:string, we should use quote | arg. In ruler.rb, all occurrences of quote | arg seems to be special case. I am fine by adding apply-path to the list, but out of curiosity, why not always use quote | arg?

Activity

  1. codeout commented on May 18, 2020

    @codeout
    Owner

    That's just a fail-safe. Some xsd:string in JUNOS which rejects quoted strings with white spaces like:

    koji@vsrx# set routing-instances "a a" instance-type vrf
    error: instance_name: 'a a': Must be a non-reserved string of 128 characters or less with no spaces.
    error: statement creation failed: a a
    
          <xsd:element name="name">
            <xsd:annotation>
              <xsd:documentation>Routing instance name</xsd:documentation>
              <xsd:appinfo>
                <flag>mustquote</flag>
                <flag>identifier</flag>
                <flag>nokeyword</flag>
                <flag>current-product-support</flag>
                <regex-match deprecate="deprecate">!^((__.*__)|(all)|(.*[ ].*)|("")|(.{129,}))$</regex-match>
                <regex-match-error deprecate="deprecate">Must be a non-reserved string of 128 characters or less with no spaces.</regex-match-error>
                <match>
                  <pattern>!^((__.*__)|(all)|(.*[ ].*)|("")|(.{129,}))$</pattern>
                  <message>Must be a non-reserved string of 128 characters or less with no spaces.</message>
                </match>
                  <identifier/>
              </xsd:appinfo>
            </xsd:annotation>
            <xsd:complexType>
              <xsd:simpleContent>
                <xsd:extension base="xsd:string">
                  <xsd:attribute name="key" type="xsd:string" fixed="key"/>
                </xsd:extension>
              </xsd:simpleContent>
            </xsd:complexType>
          </xsd:element>
            <!-- </name> -->

    Generally speaking, single-word should always be safe while "quoted strings" shouldn't. I know <regex-match deprecate="deprecate"> could be a hint in this case and there might be something else to determine which syntax can accept "quoted strings" but it's very hard to study all xsd:string unfortunately.

  2. codeout commented on May 20, 2020

    @codeout
    Owner

    Just published v0.3.13 including #17 through #21. Also it will fix this issue under policy-options prefix-list xxx apply-path but I didn't translate all xsd:string into quote | arg. There are still things we need to figure out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions