[CONTROLLER-644] JMXGenerator IllegalStateException when referring a Grouping from augmented model Created: 24/Jul/14  Updated: 25/Jul/23  Resolved: 30/Jul/14

Status: Resolved
Project: controller
Component/s: config
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Miloslav Radakovic Assignee: Maros Marsalek
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Windows
Platform: PC


Attachments: Zip Archive test.zip    
External issue ID: 1410

 Description   

I have 2 yang files when constructing a system entity:

The main file a "system.yang" where the entity-fields are defined, and configuration file "system-config.yang" that provides an augmentation to configuration with binding-broker, data-provider and rpc-registry containers inside (standard definition):

augment "/config:modules/config:module/config:configuration" {

An additional container is appended after "container rpc-registry" e.g.

container entity-config {
uses system:entity-fields;

leaf description

{ type string; }


}

If I removed the "leaf description" from the "system-config.yang", I'm getting a following ERROR. If the "leaf description" remains no ERROR is thrown and entity's fields are generated:

[ERROR] Failed to execute goal org.opendaylight.yangtools:yang-maven-plugin:0.6.2-SNAPSHOT:generate-sources (default) on project ..: yang-to-sources: One or more code generators failed, including failed list(generatorClass=exception)

{org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator=java.lang.IllegalStateException}

-> [Help 1]

Question is why there should be an additional leaf defined?



 Comments   
Comment by Maros Marsalek [ 28/Jul/14 ]

Hi,

I think there should be no reason for a failure when you remove the description node.

Do you have your yang schemas available somewhere ? e.g. Draft in gerrit ?

Could you give me a pointer to that so I can reproduce/debug/fix this issue ?

Thanks,
Maros

Comment by Miloslav Radakovic [ 28/Jul/14 ]

Attachment test.zip has been added with description: TestCase-JMXGenerator Error

Comment by Miloslav Radakovic [ 28/Jul/14 ]

Hi,
I don't have yang schemes in Gerrit, I can't provide them right now so I prepared a simple test case (enclosed attachment) where mentioned lines are commented ("sys-entity-conf.yang") and the ERROR is generated:

container sys-entity-config {
uses sysent:sys-entity-fields;

//leaf description-config

{ //type string; //}


}

If uncommented, build "mvn clean install" is OK.

Regards,
M

Comment by Maros Marsalek [ 29/Jul/14 ]

Thank you for the test input.

I have fixed the problem here https://git.opendaylight.org/gerrit/#/c/9423/. Setting to waiting-for-review.

There was a problem with the code generator for config subsystem. When using a container with one uses in yang, the generator assumed a dependency. Added a better check for dependency containers.

Maros

Comment by Miloslav Radakovic [ 29/Jul/14 ]

Thanx for the fixing.

Now I have an additional problem related to Yang parser. The same test case holds but in the "sys-entity" yang model I'm using "sys-entity-fields" only with the choice statement:

grouping sys-entity-fields {
choice version {
case v1 {
leaf value

{ type string; }
}
case v2 {
leaf value { type string; }


}
}
}

In this case the same ERROR is generated if I reference to entity's fields from augmented configuration model, i.e.

In "sys-entity-conf.yang" file

augment "/config:modules/config:module/config:configuration" {
case sys-entity {
when "/config:modules/config:module/config:type = 'sys-entity'";

.. binding-broker, data-provider, rpc-registry ..

container sys-entity-config

{ uses sysent:sys-entity-fields; }

}
}

If I remove the container from the augmentation, no ERROR is generated and build is OK, i.e.

augment "/config:modules/config:module/config:configuration" {
case sys-entity

{ when "/config:modules/config:module/config:type = 'sys-entity'"; .. binding-broker, data-provider, rpc-registry .. }

}

container sys-entity-config {
uses sysent:sys-entity-fields;
}

Now it seems that the ODL controller provides two different parsers or validators for the YANG language? One for not augmented and one for augmented models? I don't think this is correct from the architecture point of view.

Comment by Maros Marsalek [ 30/Jul/14 ]

About the two parsers:

Its not that ODL has 2 parsers (one for augment, one for non-augment). There is only one parser that parses the schema. However, config subsystem has its own code generator on top of schema parsed by yangtools, it only looks and validates some nodes from the schema that are tied to config subsystem. Thats why it did not fail when you put the container outside of the augmentation (It was ignored by config subsystem).

What you report is a new bug, already reported:
https://bugs.opendaylight.org/show_bug.cgi?id=1451

Changing status of this back to FIXED. The new bug will be tracked in 1451.

Maros

Comment by Maros Marsalek [ 30/Jul/14 ]

And about using choices in configuration.

It is not supported. Config subsystem and its generator supports only a subset of yang statements that can be used for configuration and those are:

leaf, leaf-list, container, list

So failing with choices under configuration augment is expected. This limitation is related to JMX usage in config subsystem. Statements other then those mentioned above are difficult to map to JMX's open types.

So I suggest using only mentioned types for configuration for now.

Comment by Miloslav Radakovic [ 30/Jul/14 ]

Thanx for the quick response and clear clarification. I will adapt yangs according to mentioned limitations.

Regards
Milo

Generated at Wed Feb 07 19:53:32 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.