Uploaded image for project: 'ONOS'
  1. ONOS
  2. ONOS-4542

LEAF ENUM TYPE issue: -ve value not accepted. as per RFC, its should accept

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 1.6.0
    • Component/s: None
    • Environment:

      ONOS BUILD

    • Story Points:
      3

      Description

      yang file:
      leaf ifType {
      type enumeration {
      enum "unbounded";
      enum ZERO;
      enum two;
      enum four;
      enum seven

      { value -2147483647; }

      }
      }

      RFC6020:
      9.6.4.2. The value Statement

      The "value" statement, which is optional, is used to associate an
      integer value with the assigned name for the enum. This integer
      value MUST be in the range -2147483648 to 2147483647, and it MUST be
      unique within the enumeration type. The value is unused by YANG and
      the XML encoding, but is carried as a convenience to implementors.

      If a value is not specified, then one will be automatically assigned.
      If the "enum" substatement is the first one defined, the assigned
      value is zero (0); otherwise, the assigned value is one greater than
      the current highest enum value.

      If the current highest value is equal to 2147483647, then an enum
      value MUST be specified for "enum" substatements following the one
      with the current highest value.

      [INFO] — yangutils-maven-plugin:1.0.0-SNAPSHOT:yang2java (default) @ onlab-rest —
      [INFO] Error in file: /home/root1/onos/utils/test/src/main/yang/Onos_Yang_1.yang at line: 49 at position: 23
      no viable alternative at input 'value -2147483647'
      [INFO]
      org.onosproject.yangutils.parser.exceptions.ParserException: no viable alternative at input 'value -2147483647'
      at org.onosproject.yangutils.parser.impl.parserutils.ParseTreeErrorListener.syntaxError(ParseTreeErrorListener.java:36)
      at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:65)
      at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:558)
      at org.antlr.v4.runtime.DefaultErrorStrategy.reportNoViableAlternative(DefaultErrorStrategy.java:310)
      at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:147)
      at org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser.enumStatementBody(GeneratedYangParser.java:9579)
      at org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser.enumStatement(GeneratedYangParser.java:8533)
      at org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser.enumSpecification(GeneratedYangParser.java:8465)
      at org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser.typeBodyStatements(GeneratedYangParser.java:6950)
      at org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser.typeStatement(GeneratedYangParser.java:6866)
      at org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser.leafStatement(GeneratedYangParser.java:12137)
      at org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser.dataDefStatement(GeneratedYangParser.java:6546)
      at org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser.bodyStatements(GeneratedYangParser.java:1818)
      at org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser.moduleBody(GeneratedYangParser.java:365)
      at org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser.moduleStatement(GeneratedYangParser.java:304)
      at org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser.yangfile(GeneratedYangParser.java:242)
      at org.onosproject.yangutils.parser.impl.YangUtilsParserManager.getDataModel(YangUtilsParserManager.java:75)
      at org.onosproject.yangutils.plugin.manager.YangUtilManager.execute(YangUtilManager.java:148)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              Vidyashree-Huawei Vidyashree Rama
              Reporter:
              sathishmurugesan sathishkumar murugesan
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: