Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with "augments" with "when" statements #15

Closed
dbarrosop opened this issue Feb 11, 2019 · 1 comment
Closed

problem with "augments" with "when" statements #15

dbarrosop opened this issue Feb 11, 2019 · 1 comment

Comments

@dbarrosop
Copy link

dbarrosop commented Feb 11, 2019

Hello,
I am trying to load some Openconfig models and I am having problems with some augmentations that have when statements. For instance:

https://github.com/openconfig/public/blob/8527e6426cf136930ff24f60939994949cefc073/release/models/vlan/openconfig-vlan.yang#L436

The error:

self = <yangson.schemanode.SchemaTreeNode object at 0x7f1df2c17898>, stmt = <yangson.statement.Statement object at 0x7f1df2ad2160>, sctx = <yangson.schemadata.SchemaContext object at 0x7f1df2a5c5f8>

    def _augment_stmt(self, stmt: Statement, sctx: SchemaContext) -> None:
        """Handle **augment** statement."""
        if not sctx.schema_data.if_features(stmt, sctx.text_mid):
            return
        path = sctx.schema_data.sni2route(stmt.argument, sctx)
        target = self.get_schema_descendant(path)
        if stmt.find1("when"):
            gr = GroupNode()
            target._add_child(gr)
            target = gr
>       target._handle_substatements(stmt, sctx)
E       AttributeError: 'NoneType' object has no attribute '_handle_substatements'

Removing the when will make it work. Is this a problem with the model or with yangson?

Regards

@dbarrosop dbarrosop changed the title problem with "augments" with "when statements problem with "augments" with "when" statements Feb 11, 2019
@dbarrosop
Copy link
Author

Just saw #10 and tested it and it seems to solve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant