Debian Codegraph @

ncclient/devices/huaweiyang.py

raw
1 """
2 Handler for Huawei device specific information through YANG.
3
4 Note that for proper import, the classname has to be:
5
6 "<Devicename>DeviceHandler"
7
8 ...where <Devicename> is something like "Default", "Huawei", 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 from ncclient.xml_ import BASE_NS_1_0
15
16 from .default import DefaultDeviceHandler
17
18 class HuaweiyangDeviceHandler(DefaultDeviceHandler):
19 """
20 Huawei handler for device specific information .
21
22 In the device_params dictionary, which is passed to __init__, you can specify
23 the parameter "ssh_subsystem_name". That allows you to configure the preferred
24 SSH subsystem name that should be tried on your Huawei switch. If connecting with
25 that name fails, or you didn't specify that name, the other known subsystem names
26 will be tried. However, if you specify it then this name will be tried first.
27
28 """
29 _EXEMPT_ERRORS = []
30
31 def __init__(self, device_params, ignore_errors=None):
32 super(HuaweiyangDeviceHandler, self).__init__(device_params, ignore_errors)
33
34 def get_capabilities(self):
35 # Just need to replace a single value in the default capabilities
36 c = []
37 c.append('urn:ietf:params:netconf:base:1.0')
38 c.append('urn:ietf:params:netconf:base:1.1')
39
40 return c
41
42 def get_xml_base_namespace_dict(self):
43 return {None: BASE_NS_1_0}
44
45 def get_xml_extra_prefix_kwargs(self):
46 d = {}
47 d.update(self.get_xml_base_namespace_dict())
48 return {"nsmap": d}