-
Notifications
You must be signed in to change notification settings - Fork 74
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
C++ YList: there is no function to remove elements from the list #811
Comments
The remove/delete function was not included to the ydk::YList class intentionally, because the operation will break order of entities in the list. Originally the feature was designed just to get key access to the YList data obtained from device. This implies that delete operation is irrelevant. Apparently you have another use case, which currently is not covered by YDK. |
Thanks for your answer, Indeed, I am using YDK as a quick way to have a C++ class implementation of yang models (in this particular the ietf-interfaces although it will be extended with other modules). I tried two workarounds and I would like to know your opinion on them: Workaround 1: If I want to remove a member of the list:
In this workaround the step 3 didn't worked. I have tried to create a new YList like this (example done with Ylist 'address' in ipv4 node in the interface-state from ietf-interfaces module): ietf-interfaces->interfaces-state->interface[ifname].ipv4.address ({"ip"}); but the C++ compiler complains telling that there is no contructor instance for this. Then I tried this (including the Entity pointer as the first parameter): ietf-interfaces->interfaces-state->interface[ifname].ipv4.address (ietf-interfaces->interfaces-state->interface[ifname].ipv4, {"ip"}); But the result is the same... Workaround 2:
This last workaround is not as "elegant" as the first one but it is the only way I have found to do it. The only thing that worries me is how to release memory occupied by the object of the old shared_ptr. So it could avoid a memory leak problem every time I want to perform a "remove" operation. How do you see them? Regards, |
We have decided to add this functionality to the YList class. We will update you when it is ready for download. |
Thanks a lot! |
Just one further question, Having a look at the CiscoDevNet/ydk-gen git repository I didn't see such update of the code for YList. Instead They have been added to the fork from ygorelik. When the issues are published here, are some of them solved in the in ygorelik fork and some in the CiscoDevNet? Or will they be applied to both repositories? is the #811 issue only solved in one of the two repos? It's a bit confusing... I am using the ydk-cpp directly as the ietf bundle is the one I am interested in. But will this code update be integrated in ydk-ccp as well? If I have to git clone the ygorelik repository I will but I just want to have a clear picture about both ygorelink and CiscoDevNet branches (and its differences) and if all will be merged someday, Thanks in advance, |
Hi,
I am writing a C++ program with the ydk in C++ and I have seen that for ydk::YList there is the "append" function but not "remove". Is there some workaround in order to remove elements from the list?
Thanks for your attention!
Regards,
The text was updated successfully, but these errors were encountered: