Beispiel #1
0
    def telnet(self, port):
        host = IPManager.get_ips(self)
        if len(host) == 0:
            host = self.name
        else:
            host = host[0]

        proc = Popen(['telnet', host, str(port)])
        proc.communicate()
Beispiel #2
0
    def connect(self, porttype, num, ssh_user='******'):
        if porttype != 'console-serial':
            raise DriverException("Cannot connect to a non-serial port")

        host = IPManager.get_ips(self)
        if len(host) == 0:
            host = self.name
        else:
            host = host[0]

        proc = Popen(['ssh', '-p', str(num + 3000), '-l', ssh_user, host])
        proc.communicate()
Beispiel #3
0
    def connect(self, porttype, num, ssh_user='******'):
        if porttype != 'console-serial':
            raise DriverException("Cannot connect to a non-serial port")

        host = IPManager.get_ips(self)
        if len(host) == 0:
            host = self.name
        else:
            host = host[0]

        proc = Popen(['ssh', '-p', str(num + 3000), '-l', ssh_user, host])
        proc.communicate()
Beispiel #4
0
    def _snmp_connect(self, port=161):
        ip = IPManager.get_ips(self)
        if not ip:
            raise ValueError('Device %s does not have an IP' % self.name)
        ip = ip[0]

        community = self.attr_values(key='snmp', subkey='community', merge_container_attrs=True)
        if not community:
            raise ValueError('Device %s does not have an SNMP community attribute' % self.name)
        
        sock = socket(AF_INET, SOCK_DGRAM)
        sock.connect((ip, port))
        return (str(community[0]), sock)
Beispiel #5
0
    def _snmp_connect(self, port=161):
        ip = IPManager.get_ips(self)
        if not ip:
            raise ValueError('Device %s does not have an IP' % self.name)
        ip = ip[0]

        community = self.attr_values(key='snmp',
                                     subkey='community',
                                     merge_container_attrs=True)
        if not community:
            raise ValueError(
                'Device %s does not have an SNMP community attribute' %
                self.name)

        sock = socket(AF_INET, SOCK_DGRAM)
        sock.connect((ip, port))
        return (str(community[0]), sock)