Revision 19e7c7f6 ncclient/operations/session.py
b/ncclient/operations/session.py | ||
---|---|---|
12 | 12 |
# See the License for the specific language governing permissions and |
13 | 13 |
# limitations under the License. |
14 | 14 |
|
15 |
'Session-related NETCONF operations'
|
|
15 |
"Session-related NETCONF operations"
|
|
16 | 16 |
|
17 | 17 |
from ncclient.xml_ import * |
18 | 18 |
|
... | ... | |
20 | 20 |
|
21 | 21 |
class CloseSession(RPC): |
22 | 22 |
|
23 |
"*<close-session>* RPC. The connection to NETCONF server is also closed."
|
|
23 |
"`close-session` RPC. The connection to NETCONF server is also closed."
|
|
24 | 24 |
|
25 | 25 |
def request(self): |
26 |
"Request graceful termination of the NETCONF session, and also close the transport." |
|
26 | 27 |
try: |
27 | 28 |
return self._request(new_ele("close-session")) |
28 | 29 |
finally: |
... | ... | |
31 | 32 |
|
32 | 33 |
class KillSession(RPC): |
33 | 34 |
|
34 |
"*<kill-session>* RPC."
|
|
35 |
|
|
35 |
"`kill-session` RPC."
|
|
36 |
|
|
36 | 37 |
def request(self, session_id): |
37 |
""" |
|
38 |
:arg session_id: *session-id* of NETCONF session to kill |
|
39 |
:type session_id: `string`
|
|
38 |
"""Force the termination of a NETCONF session (not the current one!)
|
|
39 |
|
|
40 |
*session_id* is the session identifier of the NETCONF session to be terminated as a string
|
|
40 | 41 |
""" |
41 | 42 |
node = new_ele("kill-session") |
42 |
if not isinstance(session_id, basestring): # make sure |
|
43 |
session_id = str(session_id) |
|
44 | 43 |
sub_ele(node, "session-id").text = session_id |
45 | 44 |
return self._request(node) |
Also available in: Unified diff