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

Choice and Leafref #469

Closed
temabeloglinski opened this issue Nov 30, 2023 · 9 comments
Closed

Choice and Leafref #469

temabeloglinski opened this issue Nov 30, 2023 · 9 comments

Comments

@temabeloglinski
Copy link

Hi Olof
I have a question about choice function and leafref.
For example I have this yang structure:

        choice myChoice {
            description "Fruit or Flowers";
            case fruit {
               leaf fruit-name {
                 description "Fruit name";
                 type leafref {
                  path "../../fruits/name";
                 }
              }
            }
            case flower {
               leaf flower-name {
                 description "Flower name";
                 type leafref {
                  path "../../flowers/name";
                 }
              }
          }
        }

But if I call commit, clixon returns an error - Nov 30 22:01:44: Commit failed. Edit and try again or discard changes: application operation-failed No referred YANG node found for leafref path ../../flowers/name.
In this case, the names of objects are called up when I click on the question mark, i.e. the paths are correct.
What could be the problem?

@olofhagsand
Copy link
Member

Can you please complete your example with YANG rules for "flowers/name" and "fruits/name"?
There are so many combinations of choice/leafref etc that my guess is that it is not covered by regressions.

@temabeloglinski
Copy link
Author

Yes of course.
I simplified the configuration:

list fruits {
key "name";
leaf name {
type string;
}
}

list flowers {
key "name";
leaf name {
type string;
}
}

        choice myChoice {
            description "Fruit or Flowers";
            case fruit {
               leaf fruit-name {
                 description "Fruit name";
                 type leafref {
                  path "../fruits/name";
                 }
              }
            }
            case flower {
               leaf flower-name {
                 description "Flower name";
                 type leafref {
                  path "../flowers/name";
                 }
              }
          }
        }

root@cli/> show configuration cli
set flowers 123
set flowers 2345

root@cli/> set flower-name ?
123 Flower name
2345 Flower name
Flower name

root@cli/> set flower-name 123

root@cli/> show configuration cli
set flowers 123
set flowers 2345
set flower-name 123

root@cli/> commit
Nov 30 23:16:42: Commit failed. Edit and try again or discard changes: application operation-failed No referred YANG node found for leafref path ../flowers/name
root@cli/>

@olofhagsand
Copy link
Member

Thanks, will have a look

@temabeloglinski
Copy link
Author

temabeloglinski commented Dec 28, 2023

Hi Olof!
Did you manage to reproduce this error?

@khromenokroman
Copy link
Contributor

Hi, I have such a problem, is there a solution to it?

@olofhagsand
Copy link
Member

Sorry, been busy, will try to look at it tomorrow

@olofhagsand olofhagsand added bug and removed question labels Jan 17, 2024
@olofhagsand olofhagsand self-assigned this Jan 17, 2024
@olofhagsand
Copy link
Member

Confirmed this issue

@olofhagsand
Copy link
Member

Should be fixed now. I dont think the combination of choice and leafref has ever worked.
Added regression test.
@temabeloglinski @khromenokroman please verify and if it works, close the issue

@temabeloglinski
Copy link
Author

Hi Olof!
Thank's a lot!
Everything is working.

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

No branches or pull requests

3 participants