首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ncclient.operations.rpc.RPCError:'YANG framework‘检测到’致命‘条件’此数据存储区上不支持操作‘

ncclient.operations.rpc.RPCError:'YANG framework‘检测到’致命‘条件’此数据存储区上不支持操作‘
EN

Stack Overflow用户
提问于 2019-04-08 11:10:34
回答 2查看 452关注 0票数 0

我正在使用ncclient配置cisco XR的主机名。但我收到下面的RPCError-

代码语言:javascript
复制
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'

我的代码是-

代码语言:javascript
复制
#!/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设备上的配置是-

代码语言:javascript
复制
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模块?

EN

回答 2

Stack Overflow用户

发布于 2019-04-29 14:14:58

这可能是因为思科XR不支持"urn:ietf:params:netconf:capability:writable-running:1.0".在这种情况下,您需要使用候选数据存储

票数 1
EN

Stack Overflow用户

发布于 2019-04-19 06:48:45

请尝试候选人商店,如:

====current代码

代码语言:javascript
复制
edit_result = device.edit_config(target='running',config=host_name, default_operation='merge').data_xml
    print (edit_result)

-newcode

代码语言:javascript
复制
edit_result = device.edit_config(target='candidate',config=host_name, default_operation='merge').data_xml
    print (edit_result)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55565740

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档