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

issue-90: Fix 'augment' with module namespace issue. #92

Closed
wants to merge 3 commits into from

Conversation

quantang
Copy link
Contributor

@quantang quantang commented May 7, 2019

Hi @saintkepha ,

After I went through you changelogs, I found this change should be related to the namespace issue that I mentioned in #90 and #91. With this change, both of these two issues can be resolved.
However, as it actually reverts some of your change in revision 75b0325, I am not sure whether it is some of our different understanding of the YANG schema data.

Please take a look and share your thoughts.
Cheers.

@sekur
Copy link
Collaborator

sekur commented May 7, 2019 via email

@quantang
Copy link
Contributor Author

quantang commented May 7, 2019

Hi @saintkepha ,

I guess the intention of your changes would be trying to support the attributes with the full namespace, right? Such as:

"A:group": {
  "B:group" : {
    "B:leaf": "value"
  }
}

As my change will make it only work on this way:

"A:group: {
  "B:group" : {
    "leaf": "value"
  }
}

I will take a look at whether we can support both of them.

I tried the unit test on "module.coffee", it shows the locate() function works well on both scenario, as follows:

  it "should parse augment module statement", ->
    y1 = Yang.use (Yang.parse schema1)
    y2 = Yang.parse schema2
    y2.locate('/foo:c1/foo:c2/bar:c3/bar:a2').should.have.property('tag').and.equal('a2')  // passed
    y2.locate('/foo:c1/c2/bar:c3/a2').should.have.property('tag').and.equal('a2')  // passed

I will take a look how the eval() function works on different naming.
Cheers.

@sekur
Copy link
Collaborator

sekur commented May 8, 2019 via email

Add 'module' property in yang schema, so the property can set the data
based on both the @name (contextual property name) and the
@module:@name (fully qualified property name).

Unit test added to cover these two scenario.
@quantang
Copy link
Contributor Author

quantang commented May 9, 2019

Hi @saintkepha ,

I added another change, which should make the yang-js to support both fully qualified property names and the contextual property names. It also includes the unit test on this scenario.
Please take a look and correct me if there is anything wrong.

Cheers.

If the contextual property name can match, just use the contextual one,
which should be more efficient than the fully qualified name. As the
fully qualified name need to find out the module name from the origin
or parent nodes.
@sekur
Copy link
Collaborator

sekur commented May 9, 2019

@quantang

Can we try to handle without reverting the change to augment statement transform inside extensions.coffee? I want to avoid having the module name prepended into .tag at the schema level. The reason is that when we have multiple uses/augment nested across multiple schema modules we end up with invalid prepended tag, (i.e. some-module:another-module:foo).

I think the changes to Properly class to check originating object for FQN or contextual name during .attach for initial .set should be the only necessary fix.

@quantang
Copy link
Contributor Author

quantang commented May 9, 2019

That makes sense. I agree that adding the module name into the tag attribute is not so good.
I will take a look at how it may behaviour if I change it back.

Cheers.

sekur added a commit that referenced this pull request May 9, 2019
…e cloned nodes to the augmenting module. property enforces fully-qualified name if it's externally augmented node, otherwise allows property to be set using fully-qualified name (module:tag) or just (tag)
@quantang quantang closed this May 10, 2019
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

Successfully merging this pull request may close these issues.

None yet

2 participants