| 1 |
""" |
| 2 |
Handler for Cisco CSR 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", "Nexus", 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 |
|
| 16 |
from .default import DefaultDeviceHandler |
| 17 |
from warnings import warn |
| 18 |
|
| 19 |
def csr_unknown_host_cb(host, fingerprint): |
| 20 |
#This will ignore the unknown host check when connecting to CSR devices |
| 21 |
return True |
| 22 |
|
| 23 |
class CsrDeviceHandler(DefaultDeviceHandler): |
| 24 |
""" |
| 25 |
Cisco CSR handler for device specific information. |
| 26 |
|
| 27 |
""" |
| 28 |
def __init__(self, device_params, ignore_errors=None): |
| 29 |
warn( |
| 30 |
'CsrDeviceHandler is deprecated, please use IosxeDeviceHandler', |
| 31 |
DeprecationWarning, |
| 32 |
stacklevel=2) |
| 33 |
super(CsrDeviceHandler, self).__init__(device_params, ignore_errors) |
| 34 |
|
| 35 |
def add_additional_ssh_connect_params(self, kwargs): |
| 36 |
warn( |
| 37 |
'CsrDeviceHandler is deprecated, please use IosxeDeviceHandler', |
| 38 |
DeprecationWarning, |
| 39 |
stacklevel=2) |
| 40 |
kwargs['unknown_host_cb'] = csr_unknown_host_cb |