ncclient.operations.rpc.RPCError: «YANG framework» обнаружил «фатальное» состояние «Операция не поддерживается в этом хранилище данных» - PullRequest
0 голосов
/ 08 апреля 2019

Я настраиваю имя хоста моего cisco XR с помощью ncclient.Но я получаю ниже RPCError-

Traceback (most recent call last):
  File "obj4.py", line 13, in <module>
    edit_result = device.edit_config(target='running',config=host_name, default_operation='merge').data_xml
  File "/usr/local/lib/python3.5/dist-packages/ncclient/manager.py", line 162, in wrapper
    return self.execute(op_cls, *args, **kwds)
  File "/usr/local/lib/python3.5/dist-packages/ncclient/manager.py", line 232, in execute
    raise_mode=self._raise_mode).request(*args, **kwds)
  File "/usr/local/lib/python3.5/dist-packages/ncclient/operations/edit.py", line 67, in request
    return self._request(node)
  File "/usr/local/lib/python3.5/dist-packages/ncclient/operations/rpc.py", line 337, in _request
    raise self._reply.error
ncclient.operations.rpc.RPCError: 'YANG framework' detected the 'fatal' condition 'Operation not supported on this datastore'

Мой код -

#!/usr/bin/env python3

from ncclient import manager

with manager.connect(host='198.51.100.1',port=830,username='netman',password='netman',hostkey_verify=False,device_params={'name':'iosxr'},allow_agent=True,look_for_keys=False) as device:

    host_name = '''<config>              
        <cli-config-data>
                  <cmd>hostname Lab9XR</cmd>
                 </cli-config-data>
                        </config>'''

    edit_result = device.edit_config(target='running',config=host_name, default_operation='merge').data_xml
    print (edit_result)

Конфигурация на моем устройстве cisco XR -

RP/0/0/CPU0:ios#sh run
Mon Apr  8 02:53:28.496 UTC
Building configuration...
!! IOS XR Configuration 6.1.3
!! Last configuration change at Mon Apr  8 02:08:58 2019 by netman
!
hostname ios
interface MgmtEth0/0/CPU0/0
 shutdown
!
interface GigabitEthernet0/0/0/0
 ipv4 address 198.51.100.1 255.255.255.0
!
interface GigabitEthernet0/0/0/1
 shutdown
!
xml agent
 iteration off
!
netconf agent tty
!
netconf-yang agent
 ssh
!
ssh server v2
ssh server netconf vrf default
ssh server logging
ssh timeout 120
end

Пожалуйста, помогите решитьпроблема.Как включить модуль cli в хранилище данных этого устройства?

Ответы [ 2 ]

1 голос
/ 29 апреля 2019

Это может быть связано с тем, что Cisco XR не поддерживает «urn: ietf: params: netconf :ability: writable-running: 1.0».В этом случае вам необходимо использовать хранилище данных кандидата

0 голосов
/ 19 апреля 2019

Пожалуйста, попробуйте магазин-кандидат, например:

==== текущий код --------

edit_result = device.edit_config(target='running',config=host_name, default_operation='merge').data_xml
    print (edit_result)

---- новый код ------

edit_result = device.edit_config(target='candidate',config=host_name, default_operation='merge').data_xml
    print (edit_result)
...