[YANGTOOLS-1095] resolve issue that yang-model-validator tool fails when parsing geo-uri Created: 30/Mar/20  Updated: 17/Apr/20  Resolved: 17/Apr/20

Status: Verified
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Medium
Reporter: Jamo Luhrsen Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The below yang file (experimental/ietf-extracted-YANG-modules/iana-geo-uri-type@2014-05-08.yang)
fails validation because of the single quote in this line:

+ '(=(([-_.!~*'()[]:&+$da-zA-Z]*)(%[da-fA-F]{2})*)*)?)*'; 
submodule iana-geo-uri-type {
  belongs-to "ietf-location" {
    prefix loc;
  }  import ietf-yang-types {
    prefix yang;
  }  organization "IANA";
  contact
    "        Internet Assigned Numbers Authority     Postal: ICANN
             4676 Admiralty Way, Suite 330
             Marina del Rey, CA 90292     Tel:    +1 310 823 9358
     E-Mail: iana&iana.org";
  description
    "This YANG module defines the iana-geo-uri-type typedef,
     which contains YANG definitions for IANA-registered geo uri.     This YANG module is maintained by IANA, serializes the existing
     'geo' URI into YANG format, and reflects the 'geo URI
     Parameters' registry and 'geo URI crs Parameter Values'
     sub-registry.     The latest revision of this YANG module can be obtained from
     the IANA web site.     Requests for new values should be made to IANA via
     email (iana&iana.org).
     Copyright (c) 2014 IETF Trust and the persons identified as
     authors of the code.  All rights reserved.     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject
     to the license terms contained in, the Simplified BSD License
     set forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (http://trustee.ietf.org/license-info).";  revision 2014-05-08 {
    description
      "Initial revision.";
  }  typedef geo-uri {
    type yang:uri {
      pattern
        'geo:'
      + '-?0*(90|(([1-8][0-9]|[0-9])(.[0-9]*)?))'
      + ',-?0*(180|((1[0-7][0-9]|[1-9][0-9]|[0-9])(.[0-9]*)?))'
      + '(,-?[0-9]+(.[0-9]*)?)?'
      + '(;crs=(wgs84|[-0-9a-zA-Z]+))?'
      + '(;u=[0-9]+(.[0-9]*)?)?'
      + '(;[-da-zA-Z]+'
      + '(=(([-_.!~*()[]:&+$da-zA-Z]*)(%[da-fA-F]{2})*)*)?)*';
    }
    description
      "The geo-uri type reprents a Uniform Resource Identifier for
       Geographic Locations ('geo' URI) as defined by RFC 5870.";
    reference
      "RFC 5870: A Uniform Resource Identifier for Geographic
       Locations";
  }
}

This may just be a bug in the yang file and the parser is correctly failing, but I am not confident either way so
filing this issue in case someone knows better.



 Comments   
Comment by Robert Varga [ 17/Apr/20 ]

That is actually illegal YANG, note how there are three single quotes on that line. This makes is a single-quoted string, followed by garbage – see https://tools.ietf.org/html/rfc6020#page-36 of a similar example.

Comment by Jamo Luhrsen [ 17/Apr/20 ]

nice, thanks for the confirmation and reference. IIRC, I think pyang actually passed on this file, so probably pyang has it's own parsing bug. Anyway, I'll close this now.

Generated at Wed Feb 07 20:55:10 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.