예제 #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)
예제 #2
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,
                  '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)
예제 #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)
예제 #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)
예제 #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)
예제 #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
예제 #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()
                         })
예제 #8
0
파일: utils.py 프로젝트: jkerihuel/mmc
def chooseClientNetwork(target):
    return chooseClientIP({'uuid': target.getUUID(),
                           'fqdn': target.getFQDN(),
                           'shortname': target.getShortName(),
                           'ips': target.getIps(),
                           'macs': target.getMacs(),
                           'netmasks': target.getNetmasks()
                         })
예제 #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)
예제 #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)
예제 #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)
예제 #12
0
파일: utils.py 프로젝트: jkerihuel/mmc
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)
예제 #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)
예제 #14
0
파일: utils.py 프로젝트: pavelpromin/mmc
def chooseClientNetwork(target):
    return chooseClientIP(
        {
            "uuid": target.getUUID(),
            "fqdn": target.getFQDN(),
            "shortname": target.getShortName(),
            "ips": target.getIps(),
            "macs": target.getMacs(),
            "netmasks": target.getNetmasks(),
        }
    )
예제 #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
예제 #16
0
파일: gateway.py 프로젝트: pruebagit/mmc
 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()
예제 #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)
예제 #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()
예제 #19
0
파일: utils.py 프로젝트: pavelpromin/mmc
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
예제 #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
예제 #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)
예제 #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)
예제 #23
0
 def choose_client_ip(self, interfaces):
     return chooseClientIP(interfaces)
예제 #24
0
파일: gateway.py 프로젝트: pruebagit/mmc
 def choose_client_ip(self, interfaces):
     return chooseClientIP(interfaces)