Beispiel #1
0
    def downloadFile(self, uuid, fqdn, shortname, ips, macs, netmasks, path,
                     bwlimit):
        # choose a way to perform the operation

        ip = chooseClientIP({
            'uuid': uuid,
            'fqdn': fqdn,
            'shortname': shortname,
            'ips': ips,
            'macs': macs,
            'netmasks': netmasks
        })

        if not ip or not NetUtils.is_ipv4_format(ip):
            logging.getLogger().warn("Ivalid IP address format: '%s'" %
                                     str(ip))
            return fail(False)

        client = {
            'host': ip,
            'chosen_ip': ip,
            'uuid': uuid,
            'shortname': shortname,
            'ip': ips,
            'macs': macs,
            'protocol': 'ssh'
        }
        client['client_check'] = getClientCheck(client)
        client['server_check'] = getServerCheck(client)
        client['action'] = getAnnounceCheck('download')

        return self.call_method('download_file', client, path, bwlimit)
    def downloadFile(self,
                     uuid,
                     fqdn,
                     shortname,
                     ips,
                     macs,
                     netmasks,
                     path,
                     bwlimit):
        # choose a way to perform the operation

        ip = chooseClientIP({'uuid': uuid,
                             'fqdn': fqdn,
                             'shortname': shortname,
                             'ips': ips,
                             'macs': macs,
                             'netmasks': netmasks
                           })

        client = {'host': ip,
                  'chosen_ip': ip,
                  'uuid': uuid,
                  'shortname': shortname,
                  'ip': ips,
                  'macs': macs,
                  'protocol': 'ssh'
                  }
        client['client_check'] = getClientCheck(client)
        client['server_check'] = getServerCheck(client)
        client['action'] = getAnnounceCheck('download')

        return self.call_method('download_file', client, path, bwlimit)
Beispiel #3
0
def establishProxy(uuid, fqdn, shortname, ips, macs, requestor_ip, requested_port):
    def _finalize(result):
        if type(result) == list: # got expected struct
            (launcher, host, port) = result
            if host == '':
                host = SchedulerConfig().launchers[launcher]['host']
            return (host, port)
        else:
            return False
    # choose a way to perform the operation
    ip = chooseClientIP({
        'uuid': uuid,
        'fqdn': fqdn,
        'shortname': shortname,
        'ips': ips,
        'macs': macs
    })

    client = {
        'host': ip,
        'uuid': uuid,
        'shortname': shortname,
        'ip': ips,
        'macs': macs,
        'protocol': 'tcpsproxy'
    }
    client['client_check'] = getClientCheck(client)
    client['server_check'] = getServerCheck(client)
    client['action'] = getAnnounceCheck('vnc')

    return callOnBestLauncher(None, 'tcp_sproxy', False, client, requestor_ip, requested_port).\
        addCallback(_finalize).\
        addErrback(lambda reason: reason)
Beispiel #4
0
def downloadFile(uuid, fqdn, shortname, ips, macs, path, bwlimit):
    # choose a way to perform the operation

    # choose a way to perform the operation
    ip = chooseClientIP({
        'uuid': uuid,
        'fqdn': fqdn,
        'shortname': shortname,
        'ips': ips,
        'macs': macs
    })

    client = {
        'host': ip,
        'uuid': uuid,
        'shortname': shortname,
        'ip': ips,
        'macs': macs,
        'protocol': 'ssh'
    }
    client['client_check'] = getClientCheck(client)
    client['server_check'] = getServerCheck(client)
    client['action'] = getAnnounceCheck('download')

    return callOnBestLauncher(None, 'download_file', False, client, path, bwlimit)
Beispiel #5
0
def downloadFile(uuid, fqdn, shortname, ips, macs, netmasks, path, bwlimit):
    # choose a way to perform the operation

    # choose a way to perform the operation
    ip = chooseClientIP({
        'uuid': uuid,
        'fqdn': fqdn,
        'shortname': shortname,
        'ips': ips,
        'macs': macs,
        'netmasks': netmasks
    })

    client = {
        'host': ip,
        'uuid': uuid,
        'shortname': shortname,
        'ip': ips,
        'macs': macs,
        'protocol': 'ssh'
    }
    client['client_check'] = getClientCheck(client)
    client['server_check'] = getServerCheck(client)
    client['action'] = getAnnounceCheck('download')

    return callOnBestLauncher(None, 'download_file', False, client, path,
                              bwlimit)
Beispiel #6
0
    def establish_proxy(self, uuid, fqdn, shortname, ips, macs, netmasks,
                        requestor_ip, requested_port):
        def _finalize(result):
            if type(result) == list:  # got expected struct
                (launcher, host, port, key) = result
                if key == '-':
                    # Key not provided => TCP Proxy
                    logging.getLogger().info(
                        'VNC Proxy: launcher "%s" created new TCP Proxy to "%s:%s"'
                        % (launcher, host, str(port)))
                else:
                    # Key provided => Websocket Proxy
                    logging.getLogger().info(
                        'VNC Proxy: launcher "%s" created new WebSocket Proxy to "%s:%s" with key "%s"'
                        % (str(launcher), str(host), str(port), str(key)))
                if host == '':
                    host = SchedulerConfig().launchers[launcher]['host']
                return (host, port, key)
            else:
                return False

        # choose a way to perform the operation
        ip = chooseClientIP({
            'uuid': uuid,
            'fqdn': fqdn,
            'shortname': shortname,
            'ips': ips,
            'macs': macs,
            'netmasks': netmasks
        })

        if not ip or not NetUtils.is_ipv4_format(ip):
            logging.getLogger().warn("Ivalid IP address format: '%s'" %
                                     str(ip))
            return fail(False)

        client = {
            'host': ip,
            'chosen_ip': ip,
            'uuid': uuid,
            'shortname': shortname,
            'ip': ips,
            'macs': macs,
            'protocol': 'tcpsproxy'
        }
        client['client_check'] = getClientCheck(client)
        client['server_check'] = getServerCheck(client)
        client['action'] = getAnnounceCheck('vnc')

        d = self.call_method('tcp_sproxy', client, requestor_ip,
                             requested_port)
        d.addCallback(_finalize)

        @d.addErrback
        def _eb(failure):
            logging.getLogger().warn("VNC proxy open failed: %s" %
                                     str(failure))

        return d
Beispiel #7
0
def chooseClientNetwork(target):
    return chooseClientIP({'uuid': target.getUUID(),
                           'fqdn': target.getFQDN(),
                           'shortname': target.getShortName(),
                           'ips': target.getIps(),
                           'macs': target.getMacs(),
                           'netmasks': target.getNetmasks()
                         })
Beispiel #8
0
def chooseClientNetwork(target):
    return chooseClientIP({'uuid': target.getUUID(),
                           'fqdn': target.getFQDN(),
                           'shortname': target.getShortName(),
                           'ips': target.getIps(),
                           'macs': target.getMacs(),
                           'netmasks': target.getNetmasks()
                         })
Beispiel #9
0
def pingClient(uuid, fqdn, shortname, ips, macs):
    # choose a way to perform the operation
    client = chooseClientIP({
            'uuid': uuid,
            'fqdn': fqdn,
            'shortname': shortname,
            'ips': ips,
            'macs': macs
    })
    return callOnBestLauncher(None, 'icmp', False, client)
Beispiel #10
0
def chooseClientInfo(target):
    host_dict = {'uuid': target.getUUID(),
                 'fqdn': target.getFQDN(),
                 'shortname': target.getShortName(),
                 'ips': target.getIps(),
                 'macs': target.getMacs(),
                 'netmasks': target.getNetmasks()
                }

    return chooseClientIP(host_dict)
Beispiel #11
0
def probeClient(uuid, fqdn, shortname, ips, macs):
    # choose a way to perform the operation
    client = chooseClientIP({
            'uuid': uuid,
            'fqdn': fqdn,
            'shortname': shortname,
            'ips': ips,
            'macs': macs
    })
    return callOnBestLauncher(None, 'probe', 'Unknown', client)
Beispiel #12
0
def chooseClientInfo(target):
    host_dict = {'uuid': target.getUUID(),
                 'fqdn': target.getFQDN(),
                 'shortname': target.getShortName(),
                 'ips': target.getIps(),
                 'macs': target.getMacs(),
                 'netmasks': target.getNetmasks()
                }

    return chooseClientIP(host_dict)
Beispiel #13
0
def probeClient(uuid, fqdn, shortname, ips, macs, netmasks):
    # choose a way to perform the operation
    client = chooseClientIP({
        'uuid': uuid,
        'fqdn': fqdn,
        'shortname': shortname,
        'ips': ips,
        'macs': macs,
        'netmasks': netmasks
    })
    return callOnBestLauncher(None, 'probe', 'Unknown', client)
Beispiel #14
0
def chooseClientNetwork(target):
    return chooseClientIP(
        {
            "uuid": target.getUUID(),
            "fqdn": target.getFQDN(),
            "shortname": target.getShortName(),
            "ips": target.getIps(),
            "macs": target.getMacs(),
            "netmasks": target.getNetmasks(),
        }
    )
Beispiel #15
0
    def establish_proxy(self,
                       uuid,
                       fqdn,
                       shortname,
                       ips,
                       macs,
                       netmasks,
                       requestor_ip,
                       requested_port):

        def _finalize(result):
            if type(result) == list:  # got expected struct
                (launcher, host, port, key) = result
                if key == '-':
                    # Key not provided => TCP Proxy
                    logging.getLogger().info(
                        'VNC Proxy: launcher "%s" created new TCP Proxy to "%s:%s"'
                        % (launcher, host, str(port)))
                else:
                    # Key provided => Websocket Proxy
                    logging.getLogger().info(
                        'VNC Proxy: launcher "%s" created new WebSocket Proxy to "%s:%s" with key "%s"'
                        % (str(launcher), str(host), str(port), str(key)))
                if host == '':
                    host = SchedulerConfig().launchers[launcher]['host']
                return (host, port, key)
            else:
                return False
        # choose a way to perform the operation
        ip = chooseClientIP({'uuid': uuid,
                             'fqdn': fqdn,
                             'shortname': shortname,
                             'ips': ips,
                             'macs': macs,
                             'netmasks': netmasks
                           })

        client = {'host': ip,
                  'chosen_ip': ip,
                  'uuid': uuid,
                  'shortname': shortname,
                  'ip': ips,
                  'macs': macs,
                  'protocol': 'tcpsproxy'
                 }
        client['client_check'] = getClientCheck(client)
        client['server_check'] = getServerCheck(client)
        client['action'] = getAnnounceCheck('vnc')

        d = self.call_method('tcp_sproxy', client, requestor_ip, requested_port)
        d.addCallback(_finalize)
        d.addErrback(lambda reason: reason)

        return d
Beispiel #16
0
 def ping_client(self, uuid, fqdn, shortname, ips, macs, netmasks):
     client = chooseClientIP({
         'uuid': uuid,
         'fqdn': fqdn,
         'shortname': shortname,
         'ips': ips,
         'macs': macs,
         'netmasks': netmasks
     })
     if client :
         return MscDispatcher().launchers_provider.ping_client(client)
     else :
         return self._nok()
Beispiel #17
0
    def downloadFile(self, uuid, fqdn, shortname, ips, macs, netmasks, path, bwlimit):
        # choose a way to perform the operation

        ip = chooseClientIP(
            {"uuid": uuid, "fqdn": fqdn, "shortname": shortname, "ips": ips, "macs": macs, "netmasks": netmasks}
        )

        client = {"host": ip, "uuid": uuid, "shortname": shortname, "ip": ips, "macs": macs, "protocol": "ssh"}
        client["client_check"] = getClientCheck(client)
        client["server_check"] = getServerCheck(client)
        client["action"] = getAnnounceCheck("download")

        return self.call_method("download_file", client, path, bwlimit)
Beispiel #18
0
 def ping_client(self, uuid, fqdn, shortname, ips, macs, netmasks):
     client = chooseClientIP({
         'uuid': uuid,
         'fqdn': fqdn,
         'shortname': shortname,
         'ips': ips,
         'macs': macs,
         'netmasks': netmasks
     })
     if client:
         return MscDispatcher().launchers_provider.ping_client(client)
     else:
         return self._nok()
Beispiel #19
0
def chooseClientInfo(target):
    ips = target.getIps()
    if len(ips) > 0:
        # if at least one element from list of IPs is IP format
        if any([NetUtils.is_ipv4_format(ip) for ip in ips]):
            host_dict = {
                "uuid": target.getUUID(),
                "fqdn": target.getFQDN(),
                "shortname": target.getShortName(),
                "ips": ips,
                "macs": target.getMacs(),
                "netmasks": target.getNetmasks(),
            }

            return chooseClientIP(host_dict)

    return None
Beispiel #20
0
    def establish_proxy(self, uuid, fqdn, shortname, ips, macs, netmasks, requestor_ip, requested_port):
        def _finalize(result):
            if type(result) == list:  # got expected struct
                (launcher, host, port, key) = result
                if key == "-":
                    # Key not provided => TCP Proxy
                    logging.getLogger().info(
                        'VNC Proxy: launcher "%s" created new TCP Proxy to "%s:%s"' % (launcher, host, str(port))
                    )
                else:
                    #  Key provided => Websocket Proxy
                    logging.getLogger().info(
                        'VNC Proxy: launcher "%s" created new WebSocket Proxy to "%s:%s" with key "%s"'
                        % (str(launcher), str(host), str(port), str(key))
                    )
                if host == "":
                    host = SchedulerConfig().launchers[launcher]["host"]
                return (host, port, key)
            else:
                return False

        # choose a way to perform the operation
        ip = chooseClientIP(
            {"uuid": uuid, "fqdn": fqdn, "shortname": shortname, "ips": ips, "macs": macs, "netmasks": netmasks}
        )

        client = {"host": ip, "uuid": uuid, "shortname": shortname, "ip": ips, "macs": macs, "protocol": "tcpsproxy"}
        client["client_check"] = getClientCheck(client)
        client["server_check"] = getServerCheck(client)
        client["action"] = getAnnounceCheck("vnc")

        d = self.call_method("tcp_sproxy", client, requestor_ip, requested_port)
        d.addCallback(_finalize)
        d.addErrback(lambda reason: reason)

        return d
Beispiel #21
0
    def downloadFile(self,
                     uuid,
                     fqdn,
                     shortname,
                     ips,
                     macs,
                     netmasks,
                     path,
                     bwlimit):
        # choose a way to perform the operation

        ip = chooseClientIP({'uuid': uuid,
                             'fqdn': fqdn,
                             'shortname': shortname,
                             'ips': ips,
                             'macs': macs,
                             'netmasks': netmasks
                           })

        if not ip or not NetUtils.is_ipv4_format(ip):
            logging.getLogger().warn("Ivalid IP address format: '%s'" % str(ip))
            return fail(False)

        client = {'host': ip,
                  'chosen_ip': ip,
                  'uuid': uuid,
                  'shortname': shortname,
                  'ip': ips,
                  'macs': macs,
                  'protocol': 'ssh'
                  }
        client['client_check'] = getClientCheck(client)
        client['server_check'] = getServerCheck(client)
        client['action'] = getAnnounceCheck('download')

        return self.call_method('download_file', client, path, bwlimit)
Beispiel #22
0
def establishProxy(uuid, fqdn, shortname, ips, macs, netmasks, requestor_ip,
                   requested_port):
    def _finalize(result):
        if type(result) == list:  # got expected struct
            (launcher, host, port) = result
            if host == '':
                host = SchedulerConfig().launchers[launcher]['host']
            return (host, port)
        else:
            return False

    # choose a way to perform the operation
    ip = chooseClientIP({
        'uuid': uuid,
        'fqdn': fqdn,
        'shortname': shortname,
        'ips': ips,
        'macs': macs,
        'netmasks': netmasks
    })

    client = {
        'host': ip,
        'uuid': uuid,
        'shortname': shortname,
        'ip': ips,
        'macs': macs,
        'protocol': 'tcpsproxy'
    }
    client['client_check'] = getClientCheck(client)
    client['server_check'] = getServerCheck(client)
    client['action'] = getAnnounceCheck('vnc')

    return callOnBestLauncher(None, 'tcp_sproxy', False, client, requestor_ip, requested_port).\
        addCallback(_finalize).\
        addErrback(lambda reason: reason)
Beispiel #23
0
 def choose_client_ip(self, interfaces):
     return chooseClientIP(interfaces)
Beispiel #24
0
 def choose_client_ip(self, interfaces):
     return chooseClientIP(interfaces)