Page MenuHomeVyOS Platform

XML: router-adver: validate both string (regex) and number
Open, Requires assessmentPublicBUG

Description

Having the following validation statement in https://github.com/vyos/vyos-1x/blob/current/interface-definitions/service_router-advert.xml.in for e.g.

<leafNode name="valid-lifetime">
  <properties>
    <help>Time in seconds that the prefix will remain valid (default: 30 days)</help>
    <completionHelp>
      <list>infinity</list>
    </completionHelp>
    <valueHelp>
      <format>1-4294967295</format>
      <description>Time in seconds that the prefix will remain valid</description>
    </valueHelp>
    <valueHelp>
      <format>infinity</format>
      <description>Prefix will remain preferred forever</description>
    </valueHelp>
    <constraint>
      <validator name="numeric" argument="--range 0-4294967295"/>
      <regex>(infinity)</regex>
    </constraint>
  </properties>
  <defaultValue>2592000</defaultValue>
</leafNode>

Will print: 'infinity' is not a valid integer number but the value is accepted. How can we both validate a string an an integer for the same node?

Details

Difficulty level
Unknown (require assessment)
Version
1.3-rolling-20200803
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

c-po created this task.Aug 4 2020, 8:22 AM
pasik added a subscriber: pasik.Aug 4 2020, 9:51 AM

Before adding "<defaultValue>" it was working but not now.

I tried

<constraint>
  <validator name="numeric" argument="--range 0-4294967295"/>
  <validator name="fqdn"/>
  <regex>(infinity)</regex>
</constraint>

2 validators also don't work.

I would have expected the output generated to be an OR of the validators or regexes and allow the output if any would have passed it