code: def open(self):
          
          try:
              if self.transport in ('http', 'https'):
                  connection = pyeapi.client.connect(
                      transport=self.transport,
                      host=self.hostname,
                      username=self.username,
                      password=self.password,
                      port=self.port,
                      timeout=self.timeout
                  )
              elif self.transport == 'socket':
                  connection = pyeapi.client.connect(transport=self.transport)
              else:
                  raise ConnectionException("Unknown transport: {}".format(self.transport))
  
              if self.device is None:
                  self.device = pyeapi.client.Node(connection, enablepwd=self.enablepwd)
              # does not raise an Exception if unusable
  
              # let's try to run a very simple command
              self.device.run_commands(['show clock'], encoding='text')
          except ConnectionError as ce:
              # and this is raised either if device not avaiable
              # either if HTTP(S) agent is not enabled
              # show management api http-commands
              raise ConnectionException(ce.message)
docs: Implementation of NAPALM method open.