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

set_item on operational datastore #13

Open
zfvs opened this issue Aug 25, 2021 · 12 comments
Open

set_item on operational datastore #13

zfvs opened this issue Aug 25, 2021 · 12 comments

Comments

@zfvs
Copy link

zfvs commented Aug 25, 2021

Hi,

I try to modify data in operational datastore and encounter issues. My modifications are applied but getting data fails after this operation. The modified module comes from running datastore.
I execute the following steps:

>>> import sysrepo
>>> 
>>> conn = sysrepo.SysrepoConnection()
>>> op_sess = conn.start_session("operational")
>>> op_sess.get_data('/ccap-docsis40:ccap')
{'ccap': {'vendor-extension-version': {'major-version': 1, 'minor-version': 2}, 'chassis': {'slot': [{'slot-number': 0, 'rf-card': {'line-card-name': '00:01:02:03:04:05', 'admin-state': 'up'}}]}}}
>>> a = "/ccap-docsis40:ccap/vendor-extension-version/major-version"
>>> op_sess.set_item(a, 8)
>>> op_sess.apply_changes()
>>> op_sess.get_data('/ccap-docsis40:ccap')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/dist-packages/sysrepo/session.py", line 699, in get_data
    data = self.get_data_ly(
  File "/usr/local/lib/python3.8/dist-packages/sysrepo/session.py", line 657, in get_data_ly
    check_call(
  File "/usr/local/lib/python3.8/dist-packages/sysrepo/errors.py", line 178, in check_call
    raise SysrepoError.new(msg, ret)
sysrepo.errors.SysrepoLyError: Invalid arguments - no keys for a list (lyd_find_sibling_val())., Invalid arguments - no keys for a list (lyd_find_sibling_val())., Invalid arguments - no keys for a list (lyd_find_sibling_val())., Data for more than one case branch of "line-card-type" choice present., Insert request refers node ((null)) that is going to be auto-deleted.: libyang error

Is modifying items in operational datastore supported?

@rjarry
Copy link
Collaborator

rjarry commented Sep 20, 2021

Hi @zfvs

I never tried editing data in the operational datastore but I think there are some pitfalls. @michalvasko do you see any issue here?

@michalvasko
Copy link

The use-case seems fine to me briefly looking at it but the error seems like an invalid one. What sysrepo and libyang is being used, to the bindings have any requirements in this respect?

@rjarry
Copy link
Collaborator

rjarry commented Sep 21, 2021

Only the libyang bindings have versions requirements:

https://github.com/CESNET/libyang-python/blob/v1.7.0/cffi/source.c#L8-L13

But for sysrepo (1.x) there is no version info available in the headers in order to fail at build time. As a workaround, I could add SO version requirements at link time.

@michalvasko
Copy link

But for sysrepo (1.x) there is no version info available in the headers

Yes, fixed in v2.

I was just asking, @zfvs what version of sysrepo are you then using?

@zfvs
Copy link
Author

zfvs commented Sep 21, 2021

I was using the netopeer2 docker image available here: https://hub.docker.com/r/sysrepo/sysrepo-netopeer2. There's sysrepo v1.4.103.

@michalvasko
Copy link

That may easily be the problem, you should use at least 1.4.140.

@zfvs
Copy link
Author

zfvs commented Sep 21, 2021

Did you think about updating the docker image in the docker hub?

@michalvasko
Copy link

I am not the maintainer so I cannot tell you but you should be gradually switching to sysrepo v2, anyway.

@zfvs
Copy link
Author

zfvs commented Sep 21, 2021

I'd like to but there's a lack of sysrepo and libyang bindings for v2. Do you maybe know if the work on those bindings is in progress?

@michalvasko
Copy link

That is a question back to @rjarry but AFAIK they are in progress, as you said.

@rjarry
Copy link
Collaborator

rjarry commented Sep 21, 2021

Yes I am working on v2 support on my free time, which is limited, unfortunately :)

@Salah3beed
Copy link

I am facing the same issue with sysrepo v2.2.72
Did you find any work around?

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

No branches or pull requests

4 participants