corenova / yang-js

YANG parser and composer
Apache License 2.0
56 stars 18 forks source link

Add support for bits type #106

Closed sekur closed 5 years ago

sekur commented 5 years ago

Created to address issue #103

sekur commented 5 years ago

Placeholder support added. Sufficient for parse/eval. Will need to revisit to allow numeric value assignment.

Vafa-Andalibi commented 5 years ago

Trying to import ietf-packet-field.yang I'm getting the following error:

Error [ExpressionError]: [module(ietf-packet-fields)/grouping(acl-ipv4-header-fields)/leaf(flags)/type(bits)/bit(reserved)] constraint violation for 'position' - cannot define more than once

Is this from the bits implementation? Apparently it's raised from merge , is that correct? if so, can you describe the flow a little bit and possibly what could fix it?

Thanks ,

sekur commented 5 years ago

I have a bug here:

https://github.com/corenova/yang-js/blob/0b71e97f0475e4643c770f43a80ebfc3972208af/src/lang/extensions.coffee#L136

I should be checking for this.position instead of this.value. Copy/paste bug from replicating "enum" behavior.

sekur commented 5 years ago

Also need to update testcase for bits type to use position sub-statements.

Vafa-Andalibi commented 5 years ago

@saintkepha Since I really need a working instance of bit statement, I would like to contribute. I haven't had any experience with CoffeeScript and I can't find any part of the document describing how one can contribute. Is there any documentation for contribution? It's a little bit difficult to make sense of the flow by just looking at the files and following it.

Thanks!