[問題] ncclient的問題
hi,一直以來感謝版友熱心的回答
本人工作上要使用ncclient這個library,不知這裡有沒有人研究過
我的問題是,我現在要用ncclient建立一個 NETCONF 的session到遠端機器
以下是部份code:
from ncclient import manager
import unittest
conn = manager.connect(host=***, username=***, password=***)
with conn.locked(target='running'):
conn.discard_changes()
suite = unittest.TestSuite()
suite.addTest(...)
suite.addTest(...)
unittest.TextTestRunner(verbosity=2).run(suite)
如果不用conn.locked (session不lock),則運行上沒有問題
有lock的話,在某個test中會出現以下錯誤信息:
ncclient.operations,rpc.RPCError: Module "gold-storm" is DS-locked by 8738585
代表另有一個session已經lock住這個module,我必須要得到這個session的id並刪除之
然而,我用session_id的方法查到都是三個數字,比如:290
這個8738585不知是怎麼來的
先感謝各位願意看完,我要先休息了,描述得不夠清楚的地方請多包涵
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 108.254.89.199 (美國)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1651219928.A.C97.html
→
04/30 16:10,
1年前
, 1F
04/30 16:10, 1F
→
04/30 23:51,
1年前
, 2F
04/30 23:51, 2F
→
05/01 00:15,
1年前
, 3F
05/01 00:15, 3F
→
05/01 00:26,
1年前
, 4F
05/01 00:26, 4F
→
05/01 00:26,
1年前
, 5F
05/01 00:26, 5F
→
05/01 00:26,
1年前
, 6F
05/01 00:26, 6F
→
05/01 00:28,
1年前
, 7F
05/01 00:28, 7F
→
05/01 00:28,
1年前
, 8F
05/01 00:28, 8F
→
05/01 00:29,
1年前
, 9F
05/01 00:29, 9F
→
05/01 00:29,
1年前
, 10F
05/01 00:29, 10F
→
05/01 00:32,
1年前
, 11F
05/01 00:32, 11F
→
05/01 00:38,
1年前
, 12F
05/01 00:38, 12F
→
05/01 00:38,
1年前
, 13F
05/01 00:38, 13F
→
05/01 00:38,
1年前
, 14F
05/01 00:38, 14F
→
05/01 00:47,
1年前
, 15F
05/01 00:47, 15F
→
05/01 00:47,
1年前
, 16F
05/01 00:47, 16F
→
05/01 17:21,
1年前
, 17F
05/01 17:21, 17F
→
05/01 17:24,
1年前
, 18F
05/01 17:24, 18F
→
05/01 17:25,
1年前
, 19F
05/01 17:25, 19F
→
05/01 23:10,
1年前
, 20F
05/01 23:10, 20F
→
05/01 23:10,
1年前
, 21F
05/01 23:10, 21F
→
05/01 23:53,
1年前
, 22F
05/01 23:53, 22F
→
05/02 06:23,
1年前
, 23F
05/02 06:23, 23F
→
05/02 06:23,
1年前
, 24F
05/02 06:23, 24F
→
05/02 09:56,
1年前
, 25F
05/02 09:56, 25F
推
05/02 10:40,
1年前
, 26F
05/02 10:40, 26F
推
05/02 10:42,
1年前
, 27F
05/02 10:42, 27F
→
05/02 10:43,
1年前
, 28F
05/02 10:43, 28F
→
05/03 14:54,
1年前
, 29F
05/03 14:54, 29F
→
05/03 14:55,
1年前
, 30F
05/03 14:55, 30F
→
05/03 14:55,
1年前
, 31F
05/03 14:55, 31F
NETCONF request (sent right after I lock the running datastore):
<netconf-state xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
<datastores/>
<sessions/>
<statistics/>
</netconf-state>
NETCONF response:
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<netconf-state xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
<datastores>
<datastore>
<name>running</name>
<locks>
<global-lock>
<locked-by-session>0</locked-by-session>
<locked-time>1970-01-01T01:00:00+01:00</locked-time>
</global-lock>
</locks>
</datastore>
<datastore>
<name>startup</name>
</datastore>
<datastore>
<name>candidate</name>
</datastore>
</datastores>
<sessions>
<session>
<session-id>390</session-id>
<transport>netconf-ssh</transport>
<username>root</username>
<source-host>10.42.0.91</source-host>
<login-time>2019-03-10T11:59:53+01:00</login-time>
<in-rpcs>2</in-rpcs>
<in-bad-rpcs>0</in-bad-rpcs>
<out-rpc-errors>0</out-rpc-errors>
<out-notifications>0</out-notifications>
</session>
</netconf-state>
</data>
※ 編輯: VivianAnn (168.127.213.159 美國), 05/03/2022 14:58:54