| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# by yangxufeng.zhao |
| 3 |
|
| 4 |
from ncclient.xml_ import * |
| 5 |
|
| 6 |
from ncclient.operations.rpc import RPC |
| 7 |
|
| 8 |
|
| 9 |
class CLI(RPC): |
| 10 |
def request(self, command=None): |
| 11 |
"""command text |
| 12 |
view: Execution user view exec |
| 13 |
Configuration system view exec |
| 14 |
""" |
| 15 |
# node = new_ele("execute-cli") |
| 16 |
node = new_ele("execute-cli", attrs={"xmlns":HW_PRIVATE_NS}) |
| 17 |
node.append(validated_element(command)) |
| 18 |
return self._request(node) |
| 19 |
|
| 20 |
|
| 21 |
class Action(RPC): |
| 22 |
"`execute-action` RPC" |
| 23 |
def request(self, action=None): |
| 24 |
node = new_ele("execute-action", attrs={"xmlns":HW_PRIVATE_NS}) |
| 25 |
node.append(validated_element(action)) |
| 26 |
return self._request(node) |