Debian Codegraph @

ncclient/devices/ericsson.py

raw
1 """
2 Handler for Ericsson 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", "Ericsson", 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 from ncclient.operations.errors import OperationError
16 from .default import DefaultDeviceHandler
17
18
19 class EricssonDeviceHandler(DefaultDeviceHandler):
20 """
21 Ericsson handler for device specific information.
22
23 """
24 _EXEMPT_ERRORS = []
25
26 def __init__(self, device_params, ignore_errors=None):
27 super(EricssonDeviceHandler, self).__init__(device_params, ignore_errors)
28
29 def get_xml_base_namespace_dict(self):
30 return {None: BASE_NS_1_0}
31
32 def get_xml_extra_prefix_kwargs(self):
33 d = {}
34 if self.check_device_params() is False:
35 d.update(self.get_xml_base_namespace_dict())
36 return {"nsmap": d}
37
38 def check_device_params(self):
39 value = self.device_params.get('with_ns')
40 if value in [True, False]:
41 return value
42 elif value is None:
43 return False
44 else:
45 raise OperationError('Invalid "with_ns" value: %s' % value)