def nxos_connect(self, nexus_host):
        if getattr(self.connections.get(nexus_host), 'connected', None):
            return self.connections[nexus_host]

        if not self.ncclient:
            self.ncclient = self._import_ncclient()
        nexus_ssh_port = int(self.nexus_switches[nexus_host, 'ssh_port'])
        nexus_user = self.nexus_switches[nexus_host, const.USERNAME]
        nexus_password = self.nexus_switches[nexus_host, const.PASSWORD]
        hostkey_verify = cfg.CONF.ml2_cisco.host_key_checks
        starttime = time.time()
        try:
            # With new ncclient version, we can pass device_params...
            man = self.ncclient.connect(host=nexus_host,
                                        port=nexus_ssh_port,
                                        username=nexus_user,
                                        password=nexus_password,
                                        hostkey_verify=hostkey_verify,
                                        timeout=30,
                                        device_params={"name": "nexus"})
        except Exception as e:
            # Raise a Neutron exception. Include a description of
            # the original ncclient exception.
            self.capture_and_print_timeshot(
                starttime, "connecterr", switch=nexus_host)
            raise cexc.NexusConnectFailed(nexus_host=nexus_host, exc=e)

        self.capture_and_print_timeshot(
            starttime, "connect", switch=nexus_host)
        self.connections[nexus_host] = man
        return self.connections[nexus_host]
Make SSH connection to the Nexus Switch.
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/plugins/ml2/drivers/cisco/nexus/nexus_network_driver.py/CiscoNexusDriver.nxos_connect