def create_servers(self):
        port = tempesta.upstream_port_start_from()
        server_options = [
            (('uri_p'), ('/static/index.html'), None, None),
            (('uri_s'), ('/script.php'), None, None),
            (('host_p'), ('/'), ('host'), ('static.example.com')),
            (('host_s'), ('/'), ('host'), ('s.tempesta-tech.com')),
            (('host_e'), ('/'), ('host'), ('foo.example.com')),
            (('hdr_h_p'), ('/'), ('host'), ('bar.example.com')),
            (('hdr_h_s'), ('/'), ('host'), ('test.natsys-lab.com')),
            (('hdr_h_e'), ('/'), ('host'), ('buzz.natsys-lab.com')),
            (('hdr_r_e'), ('/'), ('referer'), ('example.com')),
            (('hdr_r_s'), ('/'), ('referer'), ('http://example.com')),
            (('hdr_r_p'), ('/'), ('referer'),
             ('http://example.com/cgi-bin/show.pl')),
            (('hdr_raw_e'), ('/'), ('from'), ('*****@*****.**')),
            (('hdr_raw_p'), ('/'), ('warning'), ('172 misc warning')),
            (('default'), ('/'), None, None)
        ]

        for group, uri, header, value in server_options:
            # Don't need too many connections here.
            server = deproxy.Server(port=port, conns_n=1)
            port += 1
            server.group = group
            server.chains = self.make_chains(uri=uri,
                                             extra_header=(header, value))
            self.servers.append(server)
Beispiel #2
0
 def create_servers(self):
     """Create sever with very little connections count.
     """
     port = tempesta.upstream_port_start_from()
     server = control.Nginx(listen_port=port)
     server.conns_n = 4
     self.servers = [server]
Beispiel #3
0
    def create_servers(self):
        port = tempesta.upstream_port_start_from()
        rm_srv_n = tempesta.servers_in_group() / 3
        add_srn_n = rm_srv_n
        const_srv_n = tempesta.servers_in_group() - rm_srv_n - add_srn_n

        self.rm_srvs = []
        self.add_srvs = []
        self.const_srvs = []
        self.servers = []

        for _ in range(rm_srv_n):
            server = control.Nginx(listen_port=port)
            self.rm_srvs.append(server)
            port += 1
        for _ in range(const_srv_n):
            server = control.Nginx(listen_port=port)
            self.const_srvs.append(server)
            port += 1
        for _ in range(add_srn_n):
            server = control.Nginx(listen_port=port)
            self.add_srvs.append(server)
            port += 1

        # united array to start and stop all servers at once
        self.servers = self.rm_srvs + self.const_srvs + self.add_srvs
Beispiel #4
0
 def create_servers_helper(self, count, start_port=None, keep_alive=None):
     """ Helper function to spawn `count` servers in default configuration.
     """
     if start_port is None:
         start_port = tempesta.upstream_port_start_from()
     self.servers = []
     for i in range(count):
         self.servers.append(
             deproxy.Server(port=(start_port + i), keep_alive=keep_alive))
Beispiel #5
0
 def create_servers(self):
     port=tempesta.upstream_port_start_from()
     for group in ['primary', 'backup']:
         server = self.create_server_helper(group, port)
         port += 1
         if group == 'primary':
             self.main_server = server
         else:
             self.backup_server = server
         self.servers.append(server)
Beispiel #6
0
    def create_servers_helper(self, count, start_port=None):
        """ Helper function to spawn `count` servers in default configuration.

        See comment in Nginx.get_stats().
        """
        if start_port is None:
            start_port = tempesta.upstream_port_start_from()
        self.servers = []
        for i in range(count):
            self.servers.append(control.Nginx(listen_port=(start_port + i)))
Beispiel #7
0
def build_deproxy_echo(server, name, tester):
    port = server['port']
    if port == 'default':
        port = tempesta.upstream_port_start_from()
    else:
        port = int(port)
    srv = None
    rtype = server['response']
    if rtype == 'static':
        content = fill_template(server['response_content'], server)
        srv = DeproxyEchoServer(port=port, response=content)
    else:
        raise Exception("Invalid response type: %s" % str(rtype))
    tester.deproxy_manager.add_server(srv)
    return srv
Beispiel #8
0
    def create_servers(self):
        self.servers = []
        # default server
        defport = tempesta.upstream_port_start_from()
        server = multi_backend.NginxMP(listen_port=defport)
        self.setup_nginx_config(server.config)
        self.servers.append(server)

        server = multi_backend.NginxMP(listen_port=self.base_port,
                                       ports_n=self.num_attempts,
                                       listen_ip=self.ips[0])
        self.setup_nginx_config(server.config)
        self.servers.append(server)

        self.extra_servers_base = len(self.servers)
        for ifc in range(self.num_extra_interfaces):
            server = multi_backend.NginxMP(listen_port=self.base_port,
                                           ports_n=self.num_extra_ports,
                                           listen_ip=self.ips[ifc + 1])
            self.setup_nginx_config(server.config)
            self.servers.append(server)
Beispiel #9
0
    def create_servers(self):
        port = tempesta.upstream_port_start_from()
        server_options = [
            (('uri_p'), ('/static/index.html'), None, None),
            (('uri_s'), ('/script.php'), None, None),
            (('host_p'), ('/'), ('host'), ('static.example.com')),
            (('host_s'), ('/'), ('host'), ('s.tempesta-tech.com')),
            (('host_e'), ('/'), ('host'), ('foo.example.com')),
            (('hdr_h_p'), ('/'), ('host'), ('bar.example.com')),
            (('hdr_h_s'), ('/'), ('host'), ('test.natsys-lab.com')),
            (('hdr_h_e'), ('/'), ('host'), ('buzz.natsys-lab.com')),
            (('default'), ('/'), None, None)
        ]

        for group, uri, header, value in server_options:
            # Dont need too lot connections here.
            server = deproxy.Server(port=port, connections=1)
            port += 1
            server.group = group
            server.chains = self.make_chains(uri=uri,
                                             extra_header=(header, value))
            self.servers.append(server)
def deproxy_srv_factory(server, name, tester):
    port = server['port']
    if port == 'default':
        port = tempesta.upstream_port_start_from()
    else:
        port = int(port)
    srv = None
    ko = server.get("keep_original_data", None)
    ss = server.get("segment_size", 0)
    sg = server.get("segment_gap", 0)
    rtype = server['response']
    if rtype == 'static':
        content = fill_template(server['response_content'], server)
        srv = StaticDeproxyServer(port=port,
                                  response=content,
                                  keep_original_data=ko,
                                  segment_size=ss,
                                  segment_gap=sg)
    else:
        raise Exception("Invalid response type: %s" % str(rtype))

    tester.deproxy_manager.add_server(srv)
    return srv
Beispiel #11
0
 def create_servers_with_body(self, length):
     """ Create nginx server with long response body """
     self.create_content(length)
     port = tempesta.upstream_port_start_from()
     nginx = control.Nginx(listen_port=port)
     self.servers = [nginx]
 def create_servers(self):
     port = tempesta.upstream_port_start_from()
     self.main_server = self.create_server_helper('primary', port)
     self.backup_server = self.create_server_helper('backup', port + 1)
     self.servers.append(self.main_server)
     self.servers.append(self.backup_server)
Beispiel #13
0
 def create_servers(self):
     port = tempesta.upstream_port_start_from()
     self.servers = [deproxy.Server(port=port, conns_n=1)]
Beispiel #14
0
 def create_servers(self):
     """ Overrirde to create needed amount of upstream servers. """
     port = tempesta.upstream_port_start_from()
     self.servers = [deproxy.Server(port=port)]
Beispiel #15
0
 def create_servers(self):
     """ Overrirde to create needed amount of upstream servers. """
     port = tempesta.upstream_port_start_from()
     self.servers = [control.Nginx(listen_port=port)]
     for server in self.servers:
         server.config.set_ka(self.backend_connections)
Beispiel #16
0
 def create_servers(self):
     """ Overrirde to create needed amount of upstream servers. """
     port = tempesta.upstream_port_start_from()
     self.servers = [control.Nginx(listen_port=port)]
Beispiel #17
0
 def create_servers(self):
     port = tempesta.upstream_port_start_from()
     self.servers = [deproxy.Server(port=port, keep_alive=1)]
Beispiel #18
0
 def create_clients(self):
     port = tempesta.upstream_port_start_from()
     self.client = deproxy.Client(port=port, host='Client')
Beispiel #19
0
 def create_servers(self):
     port = tempesta.upstream_port_start_from()
     self.servers = [InvalidResponseServer(port=port)]
 def init_filter(self):
     node = self.servers[0].node
     self.filter = flacky.Filter(node)
     self.filter.init_chains()
     self.filter_ports = range(tempesta.upstream_port_start_from(),
                               self.servers[-1].config.port + 1)
Beispiel #21
0
 def create_servers(self):
     port = tempesta.upstream_port_start_from()
     keep_alive = self.messages // 10
     self.servers = [deproxy.Server(port=port, keep_alive=keep_alive)]
Beispiel #22
0
 def create_servers(self):
     port = tempesta.upstream_port_start_from()
     srv = test_response_wrong_length.InvalidResponseServer(port=port)
     self.servers = [srv]
 def create_servers(self):
     port = tempesta.upstream_port_start_from()
     server = control.Nginx(listen_port=port)
     server.conns_n = 1
     self.servers = [server]