| 1 |
from ncclient.xml_ import BASE_NS_1_0 |
| 2 |
from .default import DefaultDeviceHandler |
| 3 |
from ncclient.operations.third_party.hpcomware.rpc import DisplayCommand, ConfigCommand, Action, Rollback, Save |
| 4 |
|
| 5 |
class HpcomwareDeviceHandler(DefaultDeviceHandler): |
| 6 |
|
| 7 |
def __init__(self, device_params, ignore_errors=None): |
| 8 |
super(HpcomwareDeviceHandler, self).__init__(device_params, ignore_errors) |
| 9 |
|
| 10 |
def get_xml_base_namespace_dict(self): |
| 11 |
""" |
| 12 |
Base namespace needs a None key. |
| 13 |
|
| 14 |
See 'nsmap' argument for lxml's Element(). |
| 15 |
|
| 16 |
""" |
| 17 |
return {None: BASE_NS_1_0} |
| 18 |
|
| 19 |
def get_xml_extra_prefix_kwargs(self): |
| 20 |
""" |
| 21 |
Return keyword arguments per request, which are applied to Element(). |
| 22 |
|
| 23 |
Mostly, this is a dictionary containing the "nsmap" key. |
| 24 |
|
| 25 |
See 'nsmap' argument for lxml's Element(). |
| 26 |
|
| 27 |
""" |
| 28 |
d = { |
| 29 |
"data": "http://www.hp.com/netconf/data:1.0", |
| 30 |
"config": "http://www.hp.com/netconf/config:1.0", |
| 31 |
} |
| 32 |
d.update(self.get_xml_base_namespace_dict()) |
| 33 |
return {"nsmap": d} |
| 34 |
|
| 35 |
def add_additional_operations(self): |
| 36 |
addtl = {} |
| 37 |
addtl['cli_display'] = DisplayCommand |
| 38 |
addtl['cli_config'] = ConfigCommand |
| 39 |
addtl['action'] = Action |
| 40 |
addtl['rollback'] = Rollback |
| 41 |
addtl['save'] = Save |
| 42 |
return addtl |