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

Error with submodules and feature Interaction #158

Open
getabc opened this issue Nov 5, 2024 · 2 comments
Open

Error with submodules and feature Interaction #158

getabc opened this issue Nov 5, 2024 · 2 comments
Labels
bug Something isn't working fixed: plz verify Bug/feature is fixed by developer, need verification

Comments

@getabc
Copy link

getabc commented Nov 5, 2024

We have a if feature called in a submodule

submodule infix-if-container {
  belongs-to infix-interfaces {
    prefix infix-if;
  }
...
   if-feature containers;
...
}

It's defined in the module

module infix-interfaces {
...
  include infix-if-container;
...
  feature containers {
    description "Containers is an optional build-time feature in Infix.";
  }
...  
}

We are getting the following error,

Nov  4 10:55:43.228836: yang_subparse:86: containers
Nov  4 10:55:43.228886: if_feature_check: 215: Yang error: Yang module infix-if-container has IF_FEATURE containers, but no such FEATURE statement exists: Invalid argument
Nov  4 10:55:43.228916: yang_subparse:105: retval:-1
Nov  4 10:55:43.228952: device_close_connection:189: r2s-01 Yang module infix-if-container has IF_FEATURE containers, but no such FEATURE statement exists

*** Removed incorrect RFC quote ***

@getabc
Copy link
Author

getabc commented Nov 6, 2024

I apologize for the confusion in my previous response. After carefully reviewing the quote provided, I realize that there is no explicit reference in the RFC excerpts I mentioned regarding the inheritance of features defined in the main module by submodules.
I was unable to locate the exact source of the statement I previously referenced. While Section 5.1 of the RFC discusses modules and submodules, it does not directly address the issue of feature inheritance between the main module and its submodules as I had described.
Upon further reflection, I realize I made an incorrect assumption by combining general YANG knowledge with specific RFC content without properly distinguishing between the two. I appreciate the opportunity to correct this and provide a clearer explanation.
Here are the key points I’d like to clarify:

  • Features are typically defined in the main module using the feature statement.
  • The if-feature statement can be used in both the main module and submodules to conditionally include YANG nodes or subtrees based on feature support.
  • According to RFC 7950 (YANG 1.1), Section 5.1: "A submodule can reference any definition in the module it belongs to and in all submodules included by the module." However, this does not explicitly mention the inheritance or referencing of features across modules and submodules.
  • I could not find an explicit statement in the RFC confirming that features defined in the main module can be referenced directly by submodules.
  • For a submodule to reference definitions from an external module (outside its parent module or sibling submodules), the external module must be explicitly imported in the submodule.
  • Features are boot-time parameters that cannot be changed at runtime. If a feature is not supported, all instances of YANG objects tagged with that feature's if-feature statement are excluded from the schema.
  • The evaluation of features and if-feature statements occurs during schema compilation, resulting in a feature-specific compiled schema tree.

While the general behavior suggests that features defined in the main module may be accessible to its submodules, this inference does not appear to be explicitly confirmed by the RFC text.

@olofhagsand olofhagsand added the bug Something isn't working label Nov 8, 2024
@olofhagsand olofhagsand added the fixed: plz verify Bug/feature is fixed by developer, need verification label Nov 8, 2024
@olofhagsand
Copy link
Member

Should be fixed. Please verify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed: plz verify Bug/feature is fixed by developer, need verification
Projects
None yet
Development

No branches or pull requests

2 participants