| 1 |
""" |
| 2 |
Handler for H3c device specific information. |
| 3 |
|
| 4 |
Note that for proper import, the classname has to be: |
| 5 |
|
| 6 |
"<Devicename>DeviceHandler" |
| 7 |
|
| 8 |
...where <Devicename> is something like "Default", "H3c", etc. |
| 9 |
|
| 10 |
All device-specific handlers derive from the DefaultDeviceHandler, which implements the |
| 11 |
generic information needed for interaction with a Netconf server. |
| 12 |
|
| 13 |
""" |
| 14 |
|
| 15 |
from .default import DefaultDeviceHandler |
| 16 |
from ncclient.operations.third_party.h3c.rpc import * |
| 17 |
|
| 18 |
|
| 19 |
class H3cDeviceHandler(DefaultDeviceHandler): |
| 20 |
""" |
| 21 |
H3C handler for device specific information. |
| 22 |
|
| 23 |
In the device_params dictionary, which is passed to __init__, you can specify |
| 24 |
the parameter "ssh_subsystem_name". That allows you to configure the preferred |
| 25 |
SSH subsystem name that should be tried on your H3C switch. If connecting with |
| 26 |
that name fails, or you didn't specify that name, the other known subsystem names |
| 27 |
will be tried. However, if you specify it then this name will be tried first. |
| 28 |
|
| 29 |
""" |
| 30 |
_EXEMPT_ERRORS = [] |
| 31 |
|
| 32 |
def __init__(self, device_params, ignore_errors=None): |
| 33 |
super(H3cDeviceHandler, self).__init__(device_params, ignore_errors) |
| 34 |
|
| 35 |
def add_additional_operations(self): |
| 36 |
dict = {} |
| 37 |
dict["get_bulk"] = GetBulk |
| 38 |
dict["get_bulk_config"] = GetBulkConfig |
| 39 |
dict["cli"] = CLI |
| 40 |
dict["action"] = Action |
| 41 |
dict["save"] = Save |
| 42 |
dict["load"] = Load |
| 43 |
dict["rollback"] = Rollback |
| 44 |
return dict |
| 45 |
|
| 46 |
def get_capabilities(self): |
| 47 |
# Just need to replace a single value in the default capabilities |
| 48 |
c = super(H3cDeviceHandler, self).get_capabilities() |
| 49 |
return c |
| 50 |
|
| 51 |
def get_xml_base_namespace_dict(self): |
| 52 |
return {None: BASE_NS_1_0} |
| 53 |
|
| 54 |
def get_xml_extra_prefix_kwargs(self): |
| 55 |
d = {} |
| 56 |
d.update(self.get_xml_base_namespace_dict()) |
| 57 |
return {"nsmap": d} |
| 58 |
|
| 59 |
def perform_qualify_check(self): |
| 60 |
return False |