Revision 6a2dfeb4
b/ncclient/operations/edit.py | ||
---|---|---|
29 | 29 |
|
30 | 30 |
class EditConfig(RPC): |
31 | 31 |
|
32 |
# TESTED |
|
33 |
|
|
32 | 34 |
"*<edit-config>* RPC" |
33 | 35 |
|
34 | 36 |
SPEC = {'tag': 'edit-config', 'subtree': []} |
... | ... | |
76 | 78 |
|
77 | 79 |
class DeleteConfig(RPC): |
78 | 80 |
|
81 |
# TESTED |
|
82 |
|
|
79 | 83 |
"*<delete-config>* RPC" |
80 | 84 |
|
81 | 85 |
SPEC = {'tag': 'delete-config', 'subtree': []} |
... | ... | |
148 | 152 |
|
149 | 153 |
class Commit(RPC): |
150 | 154 |
|
155 |
# TESTED |
|
156 |
|
|
151 | 157 |
"*<commit>* RPC. Depends on the *:candidate* capability." |
152 | 158 |
|
153 | 159 |
DEPENDS = [':candidate'] |
... | ... | |
184 | 190 |
|
185 | 191 |
class DiscardChanges(RPC): |
186 | 192 |
|
193 |
# TESTED |
|
194 |
|
|
187 | 195 |
"*<discard-changes>* RPC. Depends on the *:candidate* capability." |
188 | 196 |
|
189 | 197 |
DEPENDS = [':candidate'] |
b/ncclient/operations/lock.py | ||
---|---|---|
16 | 16 |
|
17 | 17 |
from copy import deepcopy |
18 | 18 |
|
19 |
from rpc import RPC |
|
19 |
from rpc import RPC, RPCReply, RPCError |
|
20 |
|
|
21 |
#class LockReply(RPCReply): |
|
22 |
# |
|
23 |
# ERROR_CLS = LockDeniedError |
|
24 |
# |
|
25 |
#class LockDeniedError(RPCError): |
|
26 |
# |
|
27 |
# def __new__(cls, err_dict): |
|
28 |
# if rpcerr['tag'] != 'lock-denied': |
|
29 |
# return RPCError(err_dict) |
|
30 |
# else: |
|
31 |
# return object.__new__(LockDeniedError) |
|
32 |
# |
|
33 |
# def __init__(self, err_dict): |
|
34 |
# RPCError.__init__(self, err_dict) |
|
20 | 35 |
|
21 | 36 |
class Lock(RPC): |
22 | 37 |
|
... | ... | |
32 | 47 |
} |
33 | 48 |
} |
34 | 49 |
|
50 |
#REPLY_CLS = LockReply |
|
51 |
|
|
35 | 52 |
def request(self, target): |
36 | 53 |
""" |
37 | 54 |
:arg target: see :ref:`source_target` |
b/ncclient/operations/rpc.py | ||
---|---|---|
14 | 14 |
|
15 | 15 |
from threading import Event, Lock |
16 | 16 |
from uuid import uuid1 |
17 |
from weakref import WeakValueDictionary |
|
18 | 17 |
|
19 | 18 |
from ncclient import content |
20 | 19 |
from ncclient.transport import SessionListener |
... | ... | |
188 | 187 |
if instance is None: |
189 | 188 |
instance = object.__new__(cls) |
190 | 189 |
instance._lock = Lock() |
191 |
instance._id2rpc = WeakValueDictionary()
|
|
190 |
instance._id2rpc = {}
|
|
192 | 191 |
instance._pipelined = session.can_pipeline |
193 | 192 |
session.add_listener(instance) |
194 | 193 |
return instance |
... | ... | |
225 | 224 |
rpc.deliver_reply(raw) |
226 | 225 |
|
227 | 226 |
def errback(self, err): |
228 |
for rpc in self._id2rpc.values(): |
|
229 |
rpc.deliver_error(err) |
|
227 |
try: |
|
228 |
for rpc in self._id2rpc.values(): |
|
229 |
rpc.deliver_error(err) |
|
230 |
finally: |
|
231 |
self._id2rpc.clear() |
|
230 | 232 |
|
231 | 233 |
|
232 | 234 |
class RPC(object): |
b/ncclient/operations/util.py | ||
---|---|---|
37 | 37 |
node['subtree']['tag'] = 'url' |
38 | 38 |
node['subtree']['text'] = loc |
39 | 39 |
else: |
40 |
#if loc == 'candidate': |
|
41 |
# capcheck(':candidate') |
|
42 |
#elif loc == 'startup': |
|
43 |
# capcheck(':startup') |
|
44 |
#elif loc == 'running' and wha == 'target': |
|
45 |
# capcheck(':writable-running') |
|
40 | 46 |
node['subtree']['tag'] = loc |
41 | 47 |
return node |
42 | 48 |
|
Also available in: Unified diff