File: csr.py

package info (click to toggle)
python-ncclient 0.6.13-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,144 kB
  • sloc: python: 9,208; xml: 476; makefile: 83
file content (40 lines) | stat: -rw-r--r-- 1,216 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
Handler for Cisco CSR device specific information.

Note that for proper import, the classname has to be:

    "<Devicename>DeviceHandler"

...where <Devicename> is something like "Default", "Nexus", etc.

All device-specific handlers derive from the DefaultDeviceHandler, which implements the
generic information needed for interaction with a Netconf server.

"""


from .default import DefaultDeviceHandler
from warnings import warn

def csr_unknown_host_cb(host, fingerprint):
        #This will ignore the unknown host check when connecting to CSR devices
        return True

class CsrDeviceHandler(DefaultDeviceHandler):
    """
    Cisco CSR handler for device specific information.

    """
    def __init__(self, device_params):
        warn(
            'CsrDeviceHandler is deprecated, please use IosxeDeviceHandler',
            DeprecationWarning,
            stacklevel=2)
        super(CsrDeviceHandler, self).__init__(device_params)

    def add_additional_ssh_connect_params(self, kwargs):
        warn(
            'CsrDeviceHandler is deprecated, please use IosxeDeviceHandler',
            DeprecationWarning,
            stacklevel=2)
        kwargs['unknown_host_cb'] = csr_unknown_host_cb