cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
342
Views
1
Helpful
4
Replies
Enthusiast

Can't fetch configuration data from device

Hi  !
I tried to run test code with purpose to fetch configuration from device
I used netconf service (both "get" and "get_config" operations), but face an issue
In log I could see messages like:

Can't find data tag in reply sent by device
<requested-device configuration>
...
...
  ...
</requested-device-configuration>

and

Traceback (most recent call last):

  File "3.py", line 30, in <module>

    configuration = netconf.get(provider, configuration)

  File "/usr/local/lib/python2.7/dist-packages/ydk/services/netconf_service.py", line 133, in get

    result = self._ns.get(provider, filters)

  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__

    self.gen.throw(type, value, traceback)

  File "/usr/local/lib/python2.7/dist-packages/ydk/errors/error_handler.py", line 82, in handle_runtime_error

    _raise(_exc)

  File "/usr/local/lib/python2.7/dist-packages/ydk/errors/error_handler.py", line 56, in _raise

    raise exc

ydk.errors.YServiceProviderError:

<requested-device configuration>
...
...
  ...
</requested-device-configuration>


Test code in attachement

Could you please help to understand, what am I doing wrong or what could be a reason of an issue ?


Thanks !

Everyone's tags (2)
4 REPLIES 4
Highlighted
Cisco Employee

Re: Can't fetch configuration data from device

The last line of your script seems to be missing a parameter (see docs):

configuration = junos_configuration.Configuration()
read_configuration = netconf.get_config(provider, Datastore.running, configuration)

Also can you please includes any logs you are seeing?

Highlighted
Enthusiast

Re: Can't fetch configuration data from device

Hi, Abhirame !

I ran 2 samples of code. Both considers your recommendation, one of them contains "filter" argument, another not (samples and logs in attachment).
In both cases, log written using standard python logging contains "Can't find data tag in reply sent by device"

and such message is given in shell

Traceback (most recent call last):

  File "filter_undefined.py", line 30, in <module>

    read_configuration = netconf.get_config(provider, Datastore.running)

  File "/usr/local/lib/python2.7/dist-packages/ydk/services/netconf_service.py", line 108, in get_config

    return _read_entities(provider, True, source)

  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__

    self.gen.throw(type, value, traceback)

  File "/usr/local/lib/python2.7/dist-packages/ydk/errors/error_handler.py", line 82, in handle_runtime_error

    _raise(_exc)

  File "/usr/local/lib/python2.7/dist-packages/ydk/errors/error_handler.py", line 56, in _raise

    raise exc

ydk.errors.YServiceProviderError: // full_device_configuration_in_xml_format


Thanks!

Highlighted
Cisco Employee

Re: Can't fetch configuration data from device

Highlighted
Enthusiast

Re: Can't fetch configuration data from device

OK, Thanks !