Revision 6625258b ncclient/operations/session.py
b/ncclient/operations/session.py | ||
---|---|---|
14 | 14 |
|
15 | 15 |
'Session-related NETCONF operations' |
16 | 16 |
|
17 |
from ncclient.content.parsers import RPCParser |
|
18 | 17 |
from rpc import RPC |
19 | 18 |
|
20 | 19 |
|
21 | 20 |
class CloseSession(RPC): |
22 | 21 |
|
23 |
def __init__(self): |
|
24 |
RPC.__init__(self) |
|
22 |
def __init__(self, session):
|
|
23 |
RPC.__init__(self, session)
|
|
25 | 24 |
self.spec = { 'tag': 'close-session' } |
26 | 25 |
|
27 |
def _response_cb(self, reply): |
|
28 |
RPC._response_cb(self, reply) |
|
29 |
if RPCParser.parse_ok(reply): |
|
26 |
def deliver(self, reply): |
|
27 |
RPC.deliver(self, reply) |
|
28 |
self._reply.parse() |
|
29 |
if self._reply.ok: |
|
30 | 30 |
self._listener.expect_close() |
31 | 31 |
self._session.close() |
32 | 32 |
|
33 |
def request(self, *args, **kwds):
|
|
34 |
self._do_request(spec, *args, **kwds)
|
|
33 |
def request(self, reply_event=None):
|
|
34 |
self._do_request(self.spec, reply_event)
|
|
35 | 35 |
|
36 | 36 |
|
37 | 37 |
class KillSession(RPC): |
38 | 38 |
|
39 |
def __init__(self): |
|
40 |
RPC.__init__(self) |
|
39 |
def __init__(self, session):
|
|
40 |
RPC.__init__(self, session)
|
|
41 | 41 |
self.spec = { |
42 | 42 |
'tag': 'kill-session', |
43 | 43 |
'children': [ { 'tag': 'session-id', 'text': None} ] |
Also available in: Unified diff