예제 #1
0
    def __init__(self, **kvargs):
        """
        :kvargs['user']:
          defaults to 'root'

        :kvargs['passwd']:
          defaults to empty; NOOB Junos device there is
          no root password initially

        :kvargs['attempts']:
          the total number of login attempts thru the login
          state-machine
        """
        # logic args
        self.hostname = self.__dict__.get('host')
        self.user = kvargs.get('user', 'root')
        self.passwd = kvargs.get('passwd', '')
        self.c_user = kvargs.get('s_user', self.user)
        self.c_passwd = kvargs.get('s_passwd', self.passwd)
        self.login_attempts = kvargs.get('attempts') or self.LOGIN_RETRY
        self.console_has_banner = kvargs.get('console_has_banner') or False

        # misc setup
        self.nc = tty_netconf(self)
        self.state = self._ST_INIT
        self._badpasswd = 0
        self._loader = 0
예제 #2
0
    def __init__(self, **kvargs):
        """
        :kvargs['user']:
          defaults to 'root'

        :kvargs['passwd']:
          defaults to empty; NOOB Junos devics there is
          no root password initially

        :kvargs['attempts']:
          the total number of login attempts thru the login
          state-machine
        """
        # logic args
        self.hostname = self.__dict__.get('host')
        self.user = kvargs.get('user', 'root')
        self.passwd = kvargs.get('passwd', '')
        self.c_user = kvargs.get('s_user', self.user)
        self.c_passwd = kvargs.get('s_passwd', self.passwd)
        self.login_attempts = kvargs.get('attempts') or self.LOGIN_RETRY

        # misc setup
        self.nc = tty_netconf(self)
        self.state = self._ST_INIT
        self._badpasswd = 0
        self._loader = 0
예제 #3
0
    def __init__(self, **kvargs):
        """
        :kvargs['user']:
          defaults to 'root'

        :kvargs['passwd']:
          defaults to empty; NOOB Junos device there is
          no root password initially

        :kvargs['attempts']:
          the total number of login attempts thru the login
          state-machine
        """
        # logic args
        self.hostname = self.__dict__.get("host")
        self.user = kvargs.get("user", "root")
        self.passwd = kvargs.get("passwd", "")
        self.cs_user = kvargs.get("cs_user")
        self.cs_passwd = kvargs.get("cs_passwd")
        self.login_attempts = kvargs.get("attempts") or self.LOGIN_RETRY
        self.console_has_banner = kvargs.get("console_has_banner") or False
        self._huge_tree = kvargs.get("huge_tree", False)

        # misc setup
        self.nc = tty_netconf(self)
        self.state = self._ST_INIT
        self._badpasswd = 0
        self._loader = 0
예제 #4
0
 def setUp(self):
     self.tty_net = tty_netconf(MagicMock())
예제 #5
0
 def setUp(self):
     self.tty_net = tty_netconf(MagicMock())
     self.tty_net._tty.port = "/dev/tty"