Revision 65c6a607 ncclient/operations/rpc.py
b/ncclient/operations/rpc.py | ||
---|---|---|
16 | 16 |
from uuid import uuid1 |
17 | 17 |
from weakref import WeakValueDictionary |
18 | 18 |
|
19 |
import ncclient.content
|
|
19 |
from ncclient import content
|
|
20 | 20 |
|
21 | 21 |
from reply import RPCReply |
22 | 22 |
|
23 | 23 |
import logging |
24 | 24 |
logger = logging.getLogger('ncclient.rpc') |
25 | 25 |
|
26 |
|
|
27 | 26 |
class RPC(object): |
28 | 27 |
|
29 | 28 |
DEPENDS = [] |
... | ... | |
40 | 39 |
pass |
41 | 40 |
self._async = async |
42 | 41 |
self._timeout = timeout |
42 |
# keeps things simple instead of having a class attr that has to be locked |
|
43 | 43 |
self._id = uuid1().urn |
44 | 44 |
self._listener = RPCReplyListener(session) |
45 | 45 |
self._listener.register(self._id, self) |
... | ... | |
53 | 53 |
'attributes': {'message-id': self._id}, |
54 | 54 |
'subtree': opspec |
55 | 55 |
} |
56 |
return XMLConverter(spec).to_string(encoding)
|
|
56 |
return content.dtree2xml(encoding)
|
|
57 | 57 |
|
58 | 58 |
def _request(self, op): |
59 | 59 |
req = self._build(op) |
... | ... | |
125 | 125 |
return self._raw |
126 | 126 |
|
127 | 127 |
def parse(self): |
128 |
if self._parsed: return |
|
129 |
root = self._root = content.to_element(self._raw) # <rpc-reply> element |
|
128 |
if self._parsed: |
|
129 |
return |
|
130 |
root = self._root = content.xml2ele(self._raw) # <rpc-reply> element |
|
130 | 131 |
# per rfc 4741 an <ok/> tag is sent when there are no errors or warnings |
131 | 132 |
ok = content.namespaced_find(root, 'ok') |
132 | 133 |
if ok is not None: |
Also available in: Unified diff