Skip to content

Conversation

@steiler
Copy link
Contributor

@steiler steiler commented Aug 8, 2024

Allow for the augmentation of groupings.

Copy link
Member

@robshakir robshakir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change -- generally this LGTM -- please take a look at the comments and then we can get this merged.

Apologies for the delay reviewing the code.

return e
}

type YangVersion string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a docstring comment please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Reference *Value `yang:"reference" json:"-"`
Status *Value `yang:"status" json:"-"`
When *Value `yang:"when" json:",omitempty"`
Augment []*Augment `yang:"augment" json:",omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we create a different field here, since this means that this change is backwards-incompatible for existing API users. There was some discussion historically about making such changes for YANG 1.1.

If we don't do this, then we need to mark this as goyang v2. I'd prefer to see whether we can group up other API changes that would be needed to fully support y1.1 into such a release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure what exactly you want me to do here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't support changing Augment from *Augment to []*Augment since this is backwards incompatible. This means that we're going to need to all downstream clients to change.

I suggest this is implemented using a new field Augments which has the slice. If it's not, then I don't think we should merge this without discussing other cardinality changes that are needed to support YANG 1.1 in a goyang v2.

for n, m := range tt.inModules {
if err := ms.Parse(m, n); err != nil {
errs = append(errs, err)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

for _, pe := range p {
y, ok := x.Dir[pe]
if !ok {
t.Fatalf("expected module %s to contain path %s", m.Name, strings.Join(p, "/"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add more debugging output here -- e.g., "expected module %s to contain path %s, could not find element %s in parent, got children: %v"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


var m *Entry
m, errs = ms.GetModule("mod-a")
x := m
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to make these variable names a little less pithy -- curElem or something would be easier for a reader to understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

// grouping has a leafref that references outside the group.
e = ToEntry(g).dup()

switch determineYangVersion(g) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't added this kind of error checking elsewhere -- I wonder whether we should try and include the parsed YANG version somewhere in the output entry. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we want to be strict then thats probably a good idea.

type YangVersion string

const (
YangVersion10 YangVersion = "1.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/YangVersion10/YANGVersion10/ per usual Go style guidelines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@a-chartier
Copy link

This would be fantastic to have merged in.

@steiler steiler requested a review from robshakir October 28, 2025 15:03
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.

3 participants