hsa: unify echo test setup
Type: test Change-Id: I8665492c2f7755901a428aacdb27e98329ff557a Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
This commit is contained in:

committed by
Florin Coras

parent
4d05f069a3
commit
efe875e7cd
@ -5,13 +5,40 @@ func (s *VethsSuite) TestEchoBuiltin() {
|
||||
serverVeth := s.netInterfaces["vppsrv"]
|
||||
|
||||
serverVpp.vppctl("test echo server " +
|
||||
" private-segment-size 1g fifo-size 4 no-echo" +
|
||||
" uri tcp://" + serverVeth.ip4AddressString() + "/1234")
|
||||
|
||||
clientVpp := s.getContainerByName("client-vpp").vppInstance
|
||||
|
||||
o := clientVpp.vppctl("test echo client nclients 10000 bytes 1" +
|
||||
" syn-timeout 100 test-timeout 100 no-return private-segment-size 1g" +
|
||||
" fifo-size 4 uri tcp://" + serverVeth.ip4AddressString() + "/1234")
|
||||
o := clientVpp.vppctl("test echo client nclients 100 bytes 1 verbose" +
|
||||
" syn-timeout 100 test-timeout 100" +
|
||||
" uri tcp://" + serverVeth.ip4AddressString() + "/1234")
|
||||
s.log(o)
|
||||
s.assertNotContains(o, "failed:")
|
||||
}
|
||||
|
||||
func (s *VethsSuite) TestTcpWithLoss() {
|
||||
serverVpp := s.getContainerByName("server-vpp").vppInstance
|
||||
|
||||
serverVeth := s.netInterfaces[serverInterfaceName]
|
||||
serverVpp.vppctl("test echo server uri tcp://%s/20022",
|
||||
serverVeth.ip4AddressString())
|
||||
|
||||
clientVpp := s.getContainerByName("client-vpp").vppInstance
|
||||
|
||||
// Ensure that VPP doesn't abort itself with NSIM enabled
|
||||
// Warning: Removing this ping will make the test fail!
|
||||
clientVpp.vppctl("ping %s", serverVeth.ip4AddressString())
|
||||
|
||||
// Add loss of packets with Network Delay Simulator
|
||||
clientVpp.vppctl("set nsim poll-main-thread delay 0.01 ms bandwidth 40 gbit" +
|
||||
" packet-size 1400 packets-per-drop 1000")
|
||||
|
||||
clientVpp.vppctl("nsim output-feature enable-disable host-vppcln")
|
||||
|
||||
// Do echo test from client-vpp container
|
||||
output := clientVpp.vppctl("test echo client uri tcp://%s/20022 verbose echo-bytes mbytes 50",
|
||||
serverVeth.ip4AddressString())
|
||||
s.log(output)
|
||||
s.assertNotEqual(len(output), 0)
|
||||
s.assertNotContains(output, "failed: timeout")
|
||||
}
|
||||
|
@ -15,6 +15,61 @@ const vclTemplate = `vcl {
|
||||
}
|
||||
`
|
||||
|
||||
func (s *VethsSuite) TestXEchoVclClientUdp() {
|
||||
s.testXEchoVclClient("udp")
|
||||
}
|
||||
|
||||
func (s *VethsSuite) TestXEchoVclClientTcp() {
|
||||
s.testXEchoVclClient("tcp")
|
||||
}
|
||||
|
||||
func (s *VethsSuite) testXEchoVclClient(proto string) {
|
||||
port := "12345"
|
||||
serverVpp := s.getContainerByName("server-vpp").vppInstance
|
||||
|
||||
serverVeth := s.netInterfaces[serverInterfaceName]
|
||||
serverVpp.vppctl("test echo server uri %s://%s/%s fifo-size 64k", proto, serverVeth.ip4AddressString(), port)
|
||||
|
||||
echoClnContainer := s.getTransientContainerByName("client-app")
|
||||
clientVclConfContent := fmt.Sprintf(vclTemplate, echoClnContainer.getContainerWorkDir(), "2")
|
||||
echoClnContainer.createFile("/vcl.conf", clientVclConfContent)
|
||||
|
||||
testClientCommand := "vcl_test_client -N 100 -p " + proto + " " + serverVeth.ip4AddressString() + " " + port
|
||||
s.log(testClientCommand)
|
||||
echoClnContainer.addEnvVar("VCL_CONFIG", "/vcl.conf")
|
||||
o := echoClnContainer.exec(testClientCommand)
|
||||
s.log(o)
|
||||
s.assertContains(o, "CLIENT RESULTS")
|
||||
}
|
||||
|
||||
func (s *VethsSuite) TestXEchoVclServerUdp() {
|
||||
s.testXEchoVclServer("udp")
|
||||
}
|
||||
|
||||
func (s *VethsSuite) TestXEchoVclServerTcp() {
|
||||
s.testXEchoVclServer("tcp")
|
||||
}
|
||||
|
||||
func (s *VethsSuite) testXEchoVclServer(proto string) {
|
||||
port := "12345"
|
||||
srvVppCont := s.getContainerByName("server-vpp")
|
||||
srvAppCont := s.getContainerByName("server-app")
|
||||
|
||||
serverVclConfContent := fmt.Sprintf(vclTemplate, srvVppCont.getContainerWorkDir(), "1")
|
||||
srvAppCont.createFile("/vcl.conf", serverVclConfContent)
|
||||
srvAppCont.addEnvVar("VCL_CONFIG", "/vcl.conf")
|
||||
vclSrvCmd := fmt.Sprintf("vcl_test_server -p %s %s", proto, port)
|
||||
srvAppCont.execServer(vclSrvCmd)
|
||||
|
||||
serverVeth := s.netInterfaces[serverInterfaceName]
|
||||
serverVethAddress := serverVeth.ip4AddressString()
|
||||
|
||||
clientVpp := s.getContainerByName("client-vpp").vppInstance
|
||||
o := clientVpp.vppctl("test echo client uri %s://%s/%s fifo-size 64k verbose mbytes 2", proto, serverVethAddress, port)
|
||||
s.log(o)
|
||||
s.assertContains(o, "Test finished at")
|
||||
}
|
||||
|
||||
func (s *VethsSuite) testVclEcho(proto string) {
|
||||
port := "12345"
|
||||
srvVppCont := s.getContainerByName("server-vpp")
|
||||
@ -93,30 +148,3 @@ func (s *VethsSuite) testRetryAttach(proto string) {
|
||||
s.log(o)
|
||||
s.log("Done.")
|
||||
}
|
||||
|
||||
func (s *VethsSuite) TestTcpWithLoss() {
|
||||
serverVpp := s.getContainerByName("server-vpp").vppInstance
|
||||
|
||||
serverVeth := s.netInterfaces[serverInterfaceName]
|
||||
serverVpp.vppctl("test echo server uri tcp://%s/20022",
|
||||
serverVeth.ip4AddressString())
|
||||
|
||||
clientVpp := s.getContainerByName("client-vpp").vppInstance
|
||||
|
||||
// Ensure that VPP doesn't abort itself with NSIM enabled
|
||||
// Warning: Removing this ping will make the test fail!
|
||||
clientVpp.vppctl("ping %s", serverVeth.ip4AddressString())
|
||||
|
||||
// Add loss of packets with Network Delay Simulator
|
||||
clientVpp.vppctl("set nsim poll-main-thread delay 0.01 ms bandwidth 40 gbit" +
|
||||
" packet-size 1400 packets-per-drop 1000")
|
||||
|
||||
clientVpp.vppctl("nsim output-feature enable-disable host-vppcln")
|
||||
|
||||
// Do echo test from client-vpp container
|
||||
output := clientVpp.vppctl("test echo client uri tcp://%s/20022 mbytes 50",
|
||||
serverVeth.ip4AddressString())
|
||||
s.assertEqual(true, len(output) != 0)
|
||||
s.assertNotContains(output, "failed: timeout")
|
||||
s.log(output)
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -18,6 +18,7 @@
|
||||
#ifndef __included_echo_client_h__
|
||||
#define __included_echo_client_h__
|
||||
|
||||
#include <hs_apps/hs_test.h>
|
||||
#include <vnet/session/session.h>
|
||||
#include <vnet/session/application_interface.h>
|
||||
|
||||
@ -69,10 +70,12 @@ typedef struct
|
||||
|
||||
u32 cli_node_index; /**< cli process node index */
|
||||
u32 app_index; /**< app index after attach */
|
||||
session_handle_t ctrl_session_handle; /**< control session handle */
|
||||
|
||||
/*
|
||||
* Configuration params
|
||||
*/
|
||||
hs_test_cfg_t cfg;
|
||||
u32 n_clients; /**< Number of clients */
|
||||
u8 *connect_uri; /**< URI for slave's connect */
|
||||
session_endpoint_cfg_t connect_sep; /**< Sever session endpoint */
|
||||
@ -99,13 +102,11 @@ typedef struct
|
||||
*/
|
||||
u8 app_is_init;
|
||||
u8 test_client_attached;
|
||||
u8 no_return;
|
||||
u8 echo_bytes;
|
||||
u8 test_return_packets;
|
||||
int drop_packets; /**< drop all packets */
|
||||
u8 prealloc_fifos; /**< Request fifo preallocation */
|
||||
u8 prealloc_sessions;
|
||||
u8 no_output;
|
||||
u8 test_bytes;
|
||||
u8 test_failed;
|
||||
u8 transport_proto;
|
||||
u8 barrier_acq_needed;
|
||||
@ -124,6 +125,9 @@ typedef enum ec_cli_signal_
|
||||
{
|
||||
EC_CLI_CONNECTS_DONE = 1,
|
||||
EC_CLI_CONNECTS_FAILED,
|
||||
EC_CLI_CFG_SYNC,
|
||||
EC_CLI_START,
|
||||
EC_CLI_STOP,
|
||||
EC_CLI_TEST_DONE
|
||||
} ec_cli_signal_t;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
193
src/plugins/hs_apps/hs_test.h
Normal file
193
src/plugins/hs_apps/hs_test.h
Normal file
@ -0,0 +1,193 @@
|
||||
/*
|
||||
* hs_test.h
|
||||
*
|
||||
* Copyright (c) 2023 Cisco and/or its affiliates.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef __included_hs_test_t__
|
||||
#define __included_hs_test_t__
|
||||
|
||||
#include <vnet/session/application_interface.h>
|
||||
|
||||
#define HS_TEST_CFG_CTRL_MAGIC 0xfeedface
|
||||
#define HS_TEST_CFG_TXBUF_SIZE_DEF 8192
|
||||
#define HS_TEST_CFG_RXBUF_SIZE_DEF (64 * HS_TEST_CFG_TXBUF_SIZE_DEF)
|
||||
#define HS_TEST_CFG_NUM_WRITES_DEF 1000000
|
||||
|
||||
#define VCL_TEST_TOKEN_HELP "#H"
|
||||
#define VCL_TEST_TOKEN_EXIT "#X"
|
||||
#define VCL_TEST_TOKEN_VERBOSE "#V"
|
||||
#define VCL_TEST_TOKEN_TXBUF_SIZE "#T:"
|
||||
#define VCL_TEST_TOKEN_NUM_TEST_SESS "#I:"
|
||||
#define VCL_TEST_TOKEN_NUM_WRITES "#N:"
|
||||
#define VCL_TEST_TOKEN_RXBUF_SIZE "#R:"
|
||||
#define VCL_TEST_TOKEN_SHOW_CFG "#C"
|
||||
#define HS_TEST_TOKEN_RUN_UNI "#U"
|
||||
#define HS_TEST_TOKEN_RUN_BI "#B"
|
||||
|
||||
#define HS_TEST_SEPARATOR_STRING " -----------------------------\n"
|
||||
|
||||
#define HS_CTRL_HANDLE (~0)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HS_TEST_CMD_SYNC,
|
||||
HS_TEST_CMD_START,
|
||||
HS_TEST_CMD_STOP,
|
||||
} hs_test_cmd_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HS_TEST_TYPE_NONE,
|
||||
HS_TEST_TYPE_ECHO,
|
||||
HS_TEST_TYPE_UNI,
|
||||
HS_TEST_TYPE_BI,
|
||||
HS_TEST_TYPE_EXIT,
|
||||
HS_TEST_TYPE_EXIT_CLIENT,
|
||||
} hs_test_t;
|
||||
|
||||
typedef struct __attribute__ ((packed))
|
||||
{
|
||||
uint32_t magic;
|
||||
uint32_t seq_num;
|
||||
uint32_t test;
|
||||
uint32_t cmd;
|
||||
uint32_t ctrl_handle;
|
||||
uint32_t num_test_sessions;
|
||||
uint32_t num_test_sessions_perq;
|
||||
uint32_t num_test_qsessions;
|
||||
uint32_t verbose;
|
||||
uint32_t address_ip6;
|
||||
uint32_t transport_udp;
|
||||
uint64_t rxbuf_size;
|
||||
uint64_t txbuf_size;
|
||||
uint64_t num_writes;
|
||||
uint64_t total_bytes;
|
||||
uint32_t test_bytes;
|
||||
} hs_test_cfg_t;
|
||||
|
||||
static inline char *
|
||||
hs_test_type_str (hs_test_t t)
|
||||
{
|
||||
switch (t)
|
||||
{
|
||||
case HS_TEST_TYPE_NONE:
|
||||
return "NONE";
|
||||
|
||||
case HS_TEST_TYPE_ECHO:
|
||||
return "ECHO";
|
||||
|
||||
case HS_TEST_TYPE_UNI:
|
||||
return "UNI";
|
||||
|
||||
case HS_TEST_TYPE_BI:
|
||||
return "BI";
|
||||
|
||||
case HS_TEST_TYPE_EXIT:
|
||||
return "EXIT";
|
||||
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
static inline int
|
||||
hs_test_cfg_verify (hs_test_cfg_t *cfg, hs_test_cfg_t *valid_cfg)
|
||||
{
|
||||
/* Note: txbuf & rxbuf on server are the same buffer,
|
||||
* so txbuf_size is not included in this check.
|
||||
*/
|
||||
return ((cfg->magic == valid_cfg->magic) && (cfg->test == valid_cfg->test) &&
|
||||
(cfg->verbose == valid_cfg->verbose) &&
|
||||
(cfg->rxbuf_size == valid_cfg->rxbuf_size) &&
|
||||
(cfg->num_writes == valid_cfg->num_writes) &&
|
||||
(cfg->total_bytes == valid_cfg->total_bytes));
|
||||
}
|
||||
|
||||
static inline void
|
||||
hs_test_cfg_init (hs_test_cfg_t *cfg)
|
||||
{
|
||||
cfg->magic = HS_TEST_CFG_CTRL_MAGIC;
|
||||
cfg->test = HS_TEST_TYPE_UNI;
|
||||
cfg->ctrl_handle = ~0;
|
||||
cfg->num_test_sessions = 1;
|
||||
cfg->num_test_sessions_perq = 1;
|
||||
cfg->verbose = 0;
|
||||
cfg->rxbuf_size = HS_TEST_CFG_RXBUF_SIZE_DEF;
|
||||
cfg->num_writes = HS_TEST_CFG_NUM_WRITES_DEF;
|
||||
cfg->txbuf_size = HS_TEST_CFG_TXBUF_SIZE_DEF;
|
||||
cfg->total_bytes = cfg->num_writes * cfg->txbuf_size;
|
||||
cfg->test_bytes = 0;
|
||||
}
|
||||
|
||||
static inline char *
|
||||
hs_test_cmd_to_str (int cmd)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
case HS_TEST_CMD_SYNC:
|
||||
return "SYNC";
|
||||
case HS_TEST_CMD_START:
|
||||
return "START";
|
||||
case HS_TEST_CMD_STOP:
|
||||
return "STOP";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static inline void
|
||||
hs_test_cfg_dump (hs_test_cfg_t *cfg, uint8_t is_client)
|
||||
{
|
||||
char *spc = " ";
|
||||
|
||||
printf (" test config (%p):\n" HS_TEST_SEPARATOR_STRING
|
||||
" command: %s\n"
|
||||
" magic: 0x%08x\n"
|
||||
" seq_num: 0x%08x\n"
|
||||
" test bytes: %s\n"
|
||||
"%-5s test: %s (%d)\n"
|
||||
" ctrl handle: %d (0x%x)\n"
|
||||
"%-5s num test sockets: %u (0x%08x)\n"
|
||||
"%-5s verbose: %s (%d)\n"
|
||||
"%-5s rxbuf size: %lu (0x%08lx)\n"
|
||||
"%-5s txbuf size: %lu (0x%08lx)\n"
|
||||
"%-5s num writes: %lu (0x%08lx)\n"
|
||||
" client tx bytes: %lu (0x%08lx)\n" HS_TEST_SEPARATOR_STRING,
|
||||
(void *) cfg, hs_test_cmd_to_str (cfg->cmd), cfg->magic,
|
||||
cfg->seq_num, cfg->test_bytes ? "yes" : "no",
|
||||
is_client && (cfg->test == HS_TEST_TYPE_UNI) ?
|
||||
"'" HS_TEST_TOKEN_RUN_UNI "'" :
|
||||
is_client && (cfg->test == HS_TEST_TYPE_BI) ?
|
||||
"'" HS_TEST_TOKEN_RUN_BI "'" :
|
||||
spc,
|
||||
hs_test_type_str (cfg->test), cfg->test, cfg->ctrl_handle,
|
||||
cfg->ctrl_handle,
|
||||
is_client ? "'" VCL_TEST_TOKEN_NUM_TEST_SESS "'" : spc,
|
||||
cfg->num_test_sessions, cfg->num_test_sessions,
|
||||
is_client ? "'" VCL_TEST_TOKEN_VERBOSE "'" : spc,
|
||||
cfg->verbose ? "on" : "off", cfg->verbose,
|
||||
is_client ? "'" VCL_TEST_TOKEN_RXBUF_SIZE "'" : spc, cfg->rxbuf_size,
|
||||
cfg->rxbuf_size, is_client ? "'" VCL_TEST_TOKEN_TXBUF_SIZE "'" : spc,
|
||||
cfg->txbuf_size, cfg->txbuf_size,
|
||||
is_client ? "'" VCL_TEST_TOKEN_NUM_WRITES "'" : spc, cfg->num_writes,
|
||||
cfg->num_writes, cfg->total_bytes, cfg->total_bytes);
|
||||
}
|
||||
|
||||
static inline u16
|
||||
hs_make_data_port (u16 p)
|
||||
{
|
||||
p = clib_net_to_host_u16 (p);
|
||||
return clib_host_to_net_u16 (p + 1);
|
||||
}
|
||||
|
||||
#endif /* __included_hs_test_t__ */
|
File diff suppressed because it is too large
Load Diff
@ -37,7 +37,7 @@ typedef struct
|
||||
int fd;
|
||||
uint8_t *buf;
|
||||
uint32_t buf_size;
|
||||
vcl_test_cfg_t cfg;
|
||||
hs_test_cfg_t cfg;
|
||||
vcl_test_stats_t stats;
|
||||
} sock_server_conn_t;
|
||||
|
||||
@ -87,7 +87,7 @@ conn_pool_expand (size_t expand_size)
|
||||
{
|
||||
sock_server_conn_t *conn = &conn_pool[i];
|
||||
memset (conn, 0, sizeof (*conn));
|
||||
vcl_test_cfg_init (&conn->cfg);
|
||||
hs_test_cfg_init (&conn->cfg);
|
||||
vcl_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */ , &conn->buf,
|
||||
&conn->buf_size);
|
||||
conn->cfg.txbuf_size = conn->cfg.rxbuf_size;
|
||||
@ -123,7 +123,7 @@ conn_pool_free (sock_server_conn_t * conn)
|
||||
}
|
||||
|
||||
static inline void
|
||||
sync_config_and_reply (sock_server_conn_t * conn, vcl_test_cfg_t * rx_cfg)
|
||||
sync_config_and_reply (sock_server_conn_t *conn, hs_test_cfg_t *rx_cfg)
|
||||
{
|
||||
conn->cfg = *rx_cfg;
|
||||
vcl_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */ ,
|
||||
@ -133,19 +133,18 @@ sync_config_and_reply (sock_server_conn_t * conn, vcl_test_cfg_t * rx_cfg)
|
||||
if (conn->cfg.verbose)
|
||||
{
|
||||
stinf ("(fd %d): Replying to cfg message!\n", conn->fd);
|
||||
vcl_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
|
||||
hs_test_cfg_dump (&conn->cfg, 0 /* is_client */);
|
||||
}
|
||||
(void) sock_test_write (conn->fd, (uint8_t *) & conn->cfg,
|
||||
sizeof (conn->cfg), NULL, conn->cfg.verbose);
|
||||
}
|
||||
|
||||
static void
|
||||
stream_test_server_start_stop (sock_server_conn_t * conn,
|
||||
vcl_test_cfg_t * rx_cfg)
|
||||
stream_test_server_start_stop (sock_server_conn_t *conn, hs_test_cfg_t *rx_cfg)
|
||||
{
|
||||
sock_server_main_t *ssm = &sock_server_main;
|
||||
int client_fd = conn->fd;
|
||||
vcl_test_t test = rx_cfg->test;
|
||||
hs_test_t test = rx_cfg->test;
|
||||
|
||||
if (rx_cfg->ctrl_handle == conn->fd)
|
||||
{
|
||||
@ -166,39 +165,37 @@ stream_test_server_start_stop (sock_server_conn_t * conn,
|
||||
|
||||
snprintf (buf, sizeof (buf), "SERVER (fd %d) RESULTS",
|
||||
tc->fd);
|
||||
vcl_test_stats_dump (buf, &tc->stats, 1 /* show_rx */ ,
|
||||
test == VCL_TEST_TYPE_BI
|
||||
/* show tx */ ,
|
||||
vcl_test_stats_dump (buf, &tc->stats, 1 /* show_rx */,
|
||||
test == HS_TEST_TYPE_BI
|
||||
/* show tx */,
|
||||
conn->cfg.verbose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vcl_test_stats_dump ("SERVER RESULTS", &conn->stats, 1 /* show_rx */ ,
|
||||
(test == VCL_TEST_TYPE_BI) /* show_tx */ ,
|
||||
vcl_test_stats_dump ("SERVER RESULTS", &conn->stats, 1 /* show_rx */,
|
||||
(test == HS_TEST_TYPE_BI) /* show_tx */,
|
||||
conn->cfg.verbose);
|
||||
vcl_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
|
||||
hs_test_cfg_dump (&conn->cfg, 0 /* is_client */);
|
||||
if (conn->cfg.verbose)
|
||||
{
|
||||
stinf (" sock server main\n"
|
||||
VCL_TEST_SEPARATOR_STRING
|
||||
stinf (" sock server main\n" HS_TEST_SEPARATOR_STRING
|
||||
" buf: %p\n"
|
||||
" buf size: %u (0x%08x)\n"
|
||||
VCL_TEST_SEPARATOR_STRING,
|
||||
" buf size: %u (0x%08x)\n" HS_TEST_SEPARATOR_STRING,
|
||||
conn->buf, conn->buf_size, conn->buf_size);
|
||||
}
|
||||
|
||||
sync_config_and_reply (conn, rx_cfg);
|
||||
stinf ("SERVER (fd %d): %s-directional Stream Test Complete!\n"
|
||||
SOCK_TEST_BANNER_STRING "\n", conn->fd,
|
||||
test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
|
||||
stinf ("SERVER (fd %d): %s-directional Stream Test "
|
||||
"Complete!\n" SOCK_TEST_BANNER_STRING "\n",
|
||||
conn->fd, test == HS_TEST_TYPE_BI ? "Bi" : "Uni");
|
||||
}
|
||||
else
|
||||
{
|
||||
stinf (SOCK_TEST_BANNER_STRING
|
||||
"SERVER (fd %d): %s-directional Stream Test!\n"
|
||||
" Sending client the test cfg to start streaming data...\n",
|
||||
client_fd, test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
|
||||
client_fd, test == HS_TEST_TYPE_BI ? "Bi" : "Uni");
|
||||
|
||||
rx_cfg->ctrl_handle = (rx_cfg->ctrl_handle == ~0) ? conn->fd :
|
||||
rx_cfg->ctrl_handle;
|
||||
@ -216,9 +213,9 @@ static inline void
|
||||
stream_test_server (sock_server_conn_t * conn, int rx_bytes)
|
||||
{
|
||||
int client_fd = conn->fd;
|
||||
vcl_test_t test = conn->cfg.test;
|
||||
hs_test_t test = conn->cfg.test;
|
||||
|
||||
if (test == VCL_TEST_TYPE_BI)
|
||||
if (test == HS_TEST_TYPE_BI)
|
||||
(void) sock_test_write (client_fd, conn->buf, rx_bytes, &conn->stats,
|
||||
conn->cfg.verbose);
|
||||
|
||||
@ -373,15 +370,14 @@ sts_server_echo (sock_server_conn_t * conn, int rx_bytes)
|
||||
}
|
||||
|
||||
static int
|
||||
sts_handle_cfg (vcl_test_cfg_t * rx_cfg, sock_server_conn_t * conn,
|
||||
int rx_bytes)
|
||||
sts_handle_cfg (hs_test_cfg_t *rx_cfg, sock_server_conn_t *conn, int rx_bytes)
|
||||
{
|
||||
sock_server_main_t *ssm = &sock_server_main;
|
||||
|
||||
if (rx_cfg->verbose)
|
||||
{
|
||||
stinf ("(fd %d): Received a cfg message!\n", conn->fd);
|
||||
vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
|
||||
hs_test_cfg_dump (rx_cfg, 0 /* is_client */);
|
||||
}
|
||||
|
||||
if (rx_bytes != sizeof (*rx_cfg))
|
||||
@ -393,7 +389,7 @@ sts_handle_cfg (vcl_test_cfg_t * rx_cfg, sock_server_conn_t * conn,
|
||||
if (conn->cfg.verbose)
|
||||
{
|
||||
stinf ("(fd %d): Replying to cfg message!\n", conn->fd);
|
||||
vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
|
||||
hs_test_cfg_dump (rx_cfg, 0 /* is_client */);
|
||||
}
|
||||
sock_test_write (conn->fd, (uint8_t *) & conn->cfg, sizeof (conn->cfg),
|
||||
NULL, conn->cfg.verbose);
|
||||
@ -402,23 +398,23 @@ sts_handle_cfg (vcl_test_cfg_t * rx_cfg, sock_server_conn_t * conn,
|
||||
|
||||
switch (rx_cfg->test)
|
||||
{
|
||||
case VCL_TEST_TYPE_NONE:
|
||||
case HS_TEST_TYPE_NONE:
|
||||
sync_config_and_reply (conn, rx_cfg);
|
||||
break;
|
||||
|
||||
case VCL_TEST_TYPE_ECHO:
|
||||
case HS_TEST_TYPE_ECHO:
|
||||
if (socket_server_echo_af_unix_init (ssm))
|
||||
goto done;
|
||||
|
||||
sync_config_and_reply (conn, rx_cfg);
|
||||
break;
|
||||
|
||||
case VCL_TEST_TYPE_BI:
|
||||
case VCL_TEST_TYPE_UNI:
|
||||
case HS_TEST_TYPE_BI:
|
||||
case HS_TEST_TYPE_UNI:
|
||||
stream_test_server_start_stop (conn, rx_cfg);
|
||||
break;
|
||||
|
||||
case VCL_TEST_TYPE_EXIT:
|
||||
case HS_TEST_TYPE_EXIT:
|
||||
stinf ("Have a great day connection %d!", conn->fd);
|
||||
close (conn->fd);
|
||||
conn_pool_free (conn);
|
||||
@ -428,7 +424,7 @@ sts_handle_cfg (vcl_test_cfg_t * rx_cfg, sock_server_conn_t * conn,
|
||||
|
||||
default:
|
||||
stinf ("ERROR: Unknown test type!\n");
|
||||
vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
|
||||
hs_test_cfg_dump (rx_cfg, 0 /* is_client */);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -439,7 +435,7 @@ done:
|
||||
static int
|
||||
sts_conn_expect_config (sock_server_conn_t * conn)
|
||||
{
|
||||
if (conn->cfg.test == VCL_TEST_TYPE_ECHO)
|
||||
if (conn->cfg.test == HS_TEST_TYPE_ECHO)
|
||||
return 1;
|
||||
|
||||
return (conn->stats.rx_bytes < 128
|
||||
@ -452,7 +448,7 @@ main (int argc, char **argv)
|
||||
int client_fd, rv, main_rv = 0, rx_bytes, c, v, i;
|
||||
sock_server_main_t *ssm = &sock_server_main;
|
||||
sock_server_conn_t *conn;
|
||||
vcl_test_cfg_t *rx_cfg;
|
||||
hs_test_cfg_t *rx_cfg;
|
||||
struct sockaddr_storage servaddr;
|
||||
uint16_t port = VCL_TEST_SERVER_PORT;
|
||||
uint32_t servaddr_size;
|
||||
@ -605,8 +601,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (sts_conn_expect_config (conn))
|
||||
{
|
||||
rx_cfg = (vcl_test_cfg_t *) conn->buf;
|
||||
if (rx_cfg->magic == VCL_TEST_CFG_CTRL_MAGIC)
|
||||
rx_cfg = (hs_test_cfg_t *) conn->buf;
|
||||
if (rx_cfg->magic == HS_TEST_CFG_CTRL_MAGIC)
|
||||
{
|
||||
sts_handle_cfg (rx_cfg, conn, rx_bytes);
|
||||
if (!ssm->nfds)
|
||||
@ -619,8 +615,8 @@ main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if ((conn->cfg.test == VCL_TEST_TYPE_UNI)
|
||||
|| (conn->cfg.test == VCL_TEST_TYPE_BI))
|
||||
if ((conn->cfg.test == HS_TEST_TYPE_UNI) ||
|
||||
(conn->cfg.test == HS_TEST_TYPE_BI))
|
||||
{
|
||||
stream_test_server (conn, rx_bytes);
|
||||
if (ioctl (conn->fd, FIONREAD))
|
||||
|
@ -16,6 +16,7 @@
|
||||
#ifndef __vcl_test_h__
|
||||
#define __vcl_test_h__
|
||||
|
||||
#include <hs_apps/hs_test.h>
|
||||
#include <netdb.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
@ -46,24 +47,9 @@
|
||||
#define vt_atomic_add(_ptr, _val) \
|
||||
__atomic_fetch_add (_ptr, _val, __ATOMIC_RELEASE)
|
||||
|
||||
#define VCL_TEST_TOKEN_HELP "#H"
|
||||
#define VCL_TEST_TOKEN_EXIT "#X"
|
||||
#define VCL_TEST_TOKEN_VERBOSE "#V"
|
||||
#define VCL_TEST_TOKEN_TXBUF_SIZE "#T:"
|
||||
#define VCL_TEST_TOKEN_NUM_TEST_SESS "#I:"
|
||||
#define VCL_TEST_TOKEN_NUM_WRITES "#N:"
|
||||
#define VCL_TEST_TOKEN_RXBUF_SIZE "#R:"
|
||||
#define VCL_TEST_TOKEN_SHOW_CFG "#C"
|
||||
#define VCL_TEST_TOKEN_RUN_UNI "#U"
|
||||
#define VCL_TEST_TOKEN_RUN_BI "#B"
|
||||
|
||||
#define VCL_TEST_SERVER_PORT 22000
|
||||
#define VCL_TEST_LOCALHOST_IPADDR "127.0.0.1"
|
||||
|
||||
#define VCL_TEST_CFG_CTRL_MAGIC 0xfeedface
|
||||
#define VCL_TEST_CFG_NUM_WRITES_DEF 1000000
|
||||
#define VCL_TEST_CFG_TXBUF_SIZE_DEF 8192
|
||||
#define VCL_TEST_CFG_RXBUF_SIZE_DEF (64*VCL_TEST_CFG_TXBUF_SIZE_DEF)
|
||||
#define VCL_TEST_CFG_BUF_SIZE_MIN 128
|
||||
#define VCL_TEST_CFG_MAX_TEST_SESS ((uint32_t) 1e6)
|
||||
#define VCL_TEST_CFG_MAX_SELECT_SESS 512
|
||||
@ -73,43 +59,6 @@
|
||||
#define VCL_TEST_CTRL_LISTENER (~0 - 1)
|
||||
#define VCL_TEST_DATA_LISTENER (~0)
|
||||
#define VCL_TEST_DELAY_DISCONNECT 1
|
||||
#define VCL_TEST_SEPARATOR_STRING \
|
||||
" -----------------------------\n"
|
||||
typedef enum
|
||||
{
|
||||
VCL_TEST_TYPE_NONE,
|
||||
VCL_TEST_TYPE_ECHO,
|
||||
VCL_TEST_TYPE_UNI,
|
||||
VCL_TEST_TYPE_BI,
|
||||
VCL_TEST_TYPE_EXIT,
|
||||
VCL_TEST_TYPE_EXIT_CLIENT,
|
||||
} vcl_test_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
VCL_TEST_CMD_SYNC,
|
||||
VCL_TEST_CMD_START,
|
||||
VCL_TEST_CMD_STOP,
|
||||
} vcl_test_cmd_t;
|
||||
|
||||
typedef struct __attribute__ ((packed))
|
||||
{
|
||||
uint32_t magic;
|
||||
uint32_t seq_num;
|
||||
uint32_t test;
|
||||
uint32_t cmd;
|
||||
uint32_t ctrl_handle;
|
||||
uint32_t num_test_sessions;
|
||||
uint32_t num_test_sessions_perq;
|
||||
uint32_t num_test_qsessions;
|
||||
uint32_t verbose;
|
||||
uint32_t address_ip6;
|
||||
uint32_t transport_udp;
|
||||
uint64_t rxbuf_size;
|
||||
uint64_t txbuf_size;
|
||||
uint64_t num_writes;
|
||||
uint64_t total_bytes;
|
||||
} vcl_test_cfg_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -138,7 +87,7 @@ typedef struct vcl_test_session
|
||||
uint32_t rxbuf_size;
|
||||
char *txbuf;
|
||||
char *rxbuf;
|
||||
vcl_test_cfg_t cfg;
|
||||
hs_test_cfg_t cfg;
|
||||
vcl_test_stats_t stats;
|
||||
vcl_test_stats_t old_stats;
|
||||
int session_index;
|
||||
@ -159,7 +108,7 @@ vcl_test_worker_index (void)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int (*init) (vcl_test_cfg_t *cfg);
|
||||
int (*init) (hs_test_cfg_t *cfg);
|
||||
int (*open) (vcl_test_session_t *ts, vppcom_endpt_t *endpt);
|
||||
int (*listen) (vcl_test_session_t *ts, vppcom_endpt_t *endpt);
|
||||
int (*accept) (int listen_fd, vcl_test_session_t *ts);
|
||||
@ -177,7 +126,7 @@ typedef struct
|
||||
{
|
||||
const vcl_test_proto_vft_t *protos[VPPCOM_PROTO_SRTP + 1];
|
||||
uint32_t ckpair_index;
|
||||
vcl_test_cfg_t cfg;
|
||||
hs_test_cfg_t cfg;
|
||||
vcl_test_wrk_t *wrk;
|
||||
} vcl_test_main_t;
|
||||
|
||||
@ -203,37 +152,8 @@ vcl_test_stats_accumulate (vcl_test_stats_t * accum, vcl_test_stats_t * incr)
|
||||
}
|
||||
|
||||
static inline void
|
||||
vcl_test_cfg_init (vcl_test_cfg_t * cfg)
|
||||
{
|
||||
cfg->magic = VCL_TEST_CFG_CTRL_MAGIC;
|
||||
cfg->test = VCL_TEST_TYPE_UNI;
|
||||
cfg->ctrl_handle = ~0;
|
||||
cfg->num_test_sessions = 1;
|
||||
cfg->num_test_sessions_perq = 1;
|
||||
cfg->verbose = 0;
|
||||
cfg->rxbuf_size = VCL_TEST_CFG_RXBUF_SIZE_DEF;
|
||||
cfg->num_writes = VCL_TEST_CFG_NUM_WRITES_DEF;
|
||||
cfg->txbuf_size = VCL_TEST_CFG_TXBUF_SIZE_DEF;
|
||||
cfg->total_bytes = cfg->num_writes * cfg->txbuf_size;
|
||||
}
|
||||
|
||||
static inline int
|
||||
vcl_test_cfg_verify (vcl_test_cfg_t * cfg, vcl_test_cfg_t * valid_cfg)
|
||||
{
|
||||
/* Note: txbuf & rxbuf on server are the same buffer,
|
||||
* so txbuf_size is not included in this check.
|
||||
*/
|
||||
return ((cfg->magic == valid_cfg->magic)
|
||||
&& (cfg->test == valid_cfg->test)
|
||||
&& (cfg->verbose == valid_cfg->verbose)
|
||||
&& (cfg->rxbuf_size == valid_cfg->rxbuf_size)
|
||||
&& (cfg->num_writes == valid_cfg->num_writes)
|
||||
&& (cfg->total_bytes == valid_cfg->total_bytes));
|
||||
}
|
||||
|
||||
static inline void
|
||||
vcl_test_buf_alloc (vcl_test_cfg_t * cfg, uint8_t is_rxbuf, uint8_t ** buf,
|
||||
uint32_t * bufsize)
|
||||
vcl_test_buf_alloc (hs_test_cfg_t *cfg, uint8_t is_rxbuf, uint8_t **buf,
|
||||
uint32_t *bufsize)
|
||||
{
|
||||
uint32_t alloc_size = is_rxbuf ? cfg->rxbuf_size : cfg->txbuf_size;
|
||||
uint8_t *lb = realloc (*buf, (size_t) alloc_size);
|
||||
@ -274,69 +194,6 @@ vcl_test_session_buf_free (vcl_test_session_t *ts)
|
||||
ts->txbuf = 0;
|
||||
}
|
||||
|
||||
static inline char *
|
||||
vcl_test_type_str (vcl_test_t t)
|
||||
{
|
||||
switch (t)
|
||||
{
|
||||
case VCL_TEST_TYPE_NONE:
|
||||
return "NONE";
|
||||
|
||||
case VCL_TEST_TYPE_ECHO:
|
||||
return "ECHO";
|
||||
|
||||
case VCL_TEST_TYPE_UNI:
|
||||
return "UNI";
|
||||
|
||||
case VCL_TEST_TYPE_BI:
|
||||
return "BI";
|
||||
|
||||
case VCL_TEST_TYPE_EXIT:
|
||||
return "EXIT";
|
||||
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
vcl_test_cfg_dump (vcl_test_cfg_t * cfg, uint8_t is_client)
|
||||
{
|
||||
char *spc = " ";
|
||||
|
||||
printf (" test config (%p):\n"
|
||||
VCL_TEST_SEPARATOR_STRING
|
||||
" magic: 0x%08x\n"
|
||||
" seq_num: 0x%08x\n"
|
||||
"%-5s test: %s (%d)\n"
|
||||
" ctrl handle: %d (0x%x)\n"
|
||||
"%-5s num test sockets: %u (0x%08x)\n"
|
||||
"%-5s verbose: %s (%d)\n"
|
||||
"%-5s rxbuf size: %lu (0x%08lx)\n"
|
||||
"%-5s txbuf size: %lu (0x%08lx)\n"
|
||||
"%-5s num writes: %lu (0x%08lx)\n"
|
||||
" client tx bytes: %lu (0x%08lx)\n"
|
||||
VCL_TEST_SEPARATOR_STRING,
|
||||
(void *) cfg, cfg->magic, cfg->seq_num,
|
||||
is_client && (cfg->test == VCL_TEST_TYPE_UNI) ?
|
||||
"'" VCL_TEST_TOKEN_RUN_UNI "'" :
|
||||
is_client && (cfg->test == VCL_TEST_TYPE_BI) ?
|
||||
"'" VCL_TEST_TOKEN_RUN_BI "'" : spc,
|
||||
vcl_test_type_str (cfg->test), cfg->test,
|
||||
cfg->ctrl_handle, cfg->ctrl_handle,
|
||||
is_client ? "'" VCL_TEST_TOKEN_NUM_TEST_SESS "'" : spc,
|
||||
cfg->num_test_sessions, cfg->num_test_sessions,
|
||||
is_client ? "'" VCL_TEST_TOKEN_VERBOSE "'" : spc,
|
||||
cfg->verbose ? "on" : "off", cfg->verbose,
|
||||
is_client ? "'" VCL_TEST_TOKEN_RXBUF_SIZE "'" : spc,
|
||||
cfg->rxbuf_size, cfg->rxbuf_size,
|
||||
is_client ? "'" VCL_TEST_TOKEN_TXBUF_SIZE "'" : spc,
|
||||
cfg->txbuf_size, cfg->txbuf_size,
|
||||
is_client ? "'" VCL_TEST_TOKEN_NUM_WRITES "'" : spc,
|
||||
cfg->num_writes, cfg->num_writes,
|
||||
cfg->total_bytes, cfg->total_bytes);
|
||||
}
|
||||
|
||||
static inline void
|
||||
vcl_test_stats_dump (char *header, vcl_test_stats_t * stats,
|
||||
uint8_t show_rx, uint8_t show_tx, uint8_t verbose)
|
||||
@ -366,31 +223,27 @@ vcl_test_stats_dump (char *header, vcl_test_stats_t * stats,
|
||||
|
||||
if (show_tx)
|
||||
{
|
||||
printf (VCL_TEST_SEPARATOR_STRING
|
||||
" tx stats (0x%p):\n"
|
||||
VCL_TEST_SEPARATOR_STRING
|
||||
printf (HS_TEST_SEPARATOR_STRING
|
||||
" tx stats (0x%p):\n" HS_TEST_SEPARATOR_STRING
|
||||
" writes: %lu (0x%08lx)\n"
|
||||
" tx bytes: %lu (0x%08lx)\n"
|
||||
" tx eagain: %u (0x%08x)\n"
|
||||
" tx incomplete: %u (0x%08x)\n",
|
||||
(void *) stats, stats->tx_xacts, stats->tx_xacts,
|
||||
stats->tx_bytes, stats->tx_bytes,
|
||||
stats->tx_eagain, stats->tx_eagain,
|
||||
stats->tx_incomp, stats->tx_incomp);
|
||||
stats->tx_bytes, stats->tx_bytes, stats->tx_eagain,
|
||||
stats->tx_eagain, stats->tx_incomp, stats->tx_incomp);
|
||||
}
|
||||
if (show_rx)
|
||||
{
|
||||
printf (VCL_TEST_SEPARATOR_STRING
|
||||
" rx stats (0x%p):\n"
|
||||
VCL_TEST_SEPARATOR_STRING
|
||||
printf (HS_TEST_SEPARATOR_STRING
|
||||
" rx stats (0x%p):\n" HS_TEST_SEPARATOR_STRING
|
||||
" reads: %lu (0x%08lx)\n"
|
||||
" rx bytes: %lu (0x%08lx)\n"
|
||||
" rx eagain: %u (0x%08x)\n"
|
||||
" rx incomplete: %u (0x%08x)\n",
|
||||
(void *) stats, stats->rx_xacts, stats->rx_xacts,
|
||||
stats->rx_bytes, stats->rx_bytes,
|
||||
stats->rx_eagain, stats->rx_eagain,
|
||||
stats->rx_incomp, stats->rx_incomp);
|
||||
stats->rx_bytes, stats->rx_bytes, stats->rx_eagain,
|
||||
stats->rx_eagain, stats->rx_incomp, stats->rx_incomp);
|
||||
}
|
||||
if (verbose)
|
||||
printf (" start.tv_sec: %ld\n"
|
||||
@ -400,7 +253,7 @@ vcl_test_stats_dump (char *header, vcl_test_stats_t * stats,
|
||||
stats->start.tv_sec, stats->start.tv_nsec,
|
||||
stats->stop.tv_sec, stats->stop.tv_nsec);
|
||||
|
||||
printf (VCL_TEST_SEPARATOR_STRING);
|
||||
printf (HS_TEST_SEPARATOR_STRING);
|
||||
}
|
||||
|
||||
static inline double
|
||||
@ -572,25 +425,18 @@ dump_help (void)
|
||||
{
|
||||
#define INDENT "\n "
|
||||
|
||||
printf ("CLIENT: Test configuration commands:"
|
||||
INDENT VCL_TEST_TOKEN_HELP
|
||||
"\t\t\tDisplay help."
|
||||
INDENT VCL_TEST_TOKEN_EXIT
|
||||
"\t\t\tExit test client & server."
|
||||
INDENT VCL_TEST_TOKEN_SHOW_CFG
|
||||
"\t\t\tShow the current test cfg."
|
||||
INDENT VCL_TEST_TOKEN_RUN_UNI
|
||||
"\t\t\tRun the Uni-directional test."
|
||||
INDENT VCL_TEST_TOKEN_RUN_BI
|
||||
"\t\t\tRun the Bi-directional test."
|
||||
INDENT VCL_TEST_TOKEN_VERBOSE
|
||||
"\t\t\tToggle verbose setting."
|
||||
INDENT VCL_TEST_TOKEN_RXBUF_SIZE
|
||||
"<rxbuf size>\tRx buffer size (bytes)."
|
||||
INDENT VCL_TEST_TOKEN_TXBUF_SIZE
|
||||
"<txbuf size>\tTx buffer size (bytes)."
|
||||
INDENT VCL_TEST_TOKEN_NUM_WRITES
|
||||
"<# of writes>\tNumber of txbuf writes to server." "\n");
|
||||
printf (
|
||||
"CLIENT: Test configuration commands:" INDENT VCL_TEST_TOKEN_HELP
|
||||
"\t\t\tDisplay help." INDENT VCL_TEST_TOKEN_EXIT
|
||||
"\t\t\tExit test client & server." INDENT VCL_TEST_TOKEN_SHOW_CFG
|
||||
"\t\t\tShow the current test cfg." INDENT HS_TEST_TOKEN_RUN_UNI
|
||||
"\t\t\tRun the Uni-directional test." INDENT HS_TEST_TOKEN_RUN_BI
|
||||
"\t\t\tRun the Bi-directional test." INDENT VCL_TEST_TOKEN_VERBOSE
|
||||
"\t\t\tToggle verbose setting." INDENT VCL_TEST_TOKEN_RXBUF_SIZE
|
||||
"<rxbuf size>\tRx buffer size (bytes)." INDENT VCL_TEST_TOKEN_TXBUF_SIZE
|
||||
"<txbuf size>\tTx buffer size (bytes)." INDENT VCL_TEST_TOKEN_NUM_WRITES
|
||||
"<# of writes>\tNumber of txbuf writes to server."
|
||||
"\n");
|
||||
}
|
||||
|
||||
#endif /* __vcl_test_h__ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -276,7 +276,7 @@ vt_add_cert_key_pair ()
|
||||
}
|
||||
|
||||
static int
|
||||
vt_tls_init (vcl_test_cfg_t *cfg)
|
||||
vt_tls_init (hs_test_cfg_t *cfg)
|
||||
{
|
||||
return vt_add_cert_key_pair ();
|
||||
}
|
||||
@ -384,7 +384,7 @@ static const vcl_test_proto_vft_t vcl_test_tls = {
|
||||
VCL_TEST_REGISTER_PROTO (VPPCOM_PROTO_TLS, vcl_test_tls);
|
||||
|
||||
static int
|
||||
vt_dtls_init (vcl_test_cfg_t *cfg)
|
||||
vt_dtls_init (hs_test_cfg_t *cfg)
|
||||
{
|
||||
return vt_add_cert_key_pair ();
|
||||
}
|
||||
@ -492,7 +492,7 @@ static const vcl_test_proto_vft_t vcl_test_dtls = {
|
||||
VCL_TEST_REGISTER_PROTO (VPPCOM_PROTO_DTLS, vcl_test_dtls);
|
||||
|
||||
static int
|
||||
vt_quic_init (vcl_test_cfg_t *cfg)
|
||||
vt_quic_init (hs_test_cfg_t *cfg)
|
||||
{
|
||||
vcl_test_main_t *vt = &vcl_test_main;
|
||||
|
||||
|
@ -106,7 +106,7 @@ again:
|
||||
conn->endpt.ip = wrk->conn_pool[i].ip;
|
||||
conn->is_alloc = 1;
|
||||
conn->session_index = i;
|
||||
vcl_test_cfg_init (&conn->cfg);
|
||||
hs_test_cfg_init (&conn->cfg);
|
||||
return (&wrk->conn_pool[i]);
|
||||
}
|
||||
}
|
||||
@ -130,7 +130,7 @@ conn_pool_free (vcl_test_session_t *ts)
|
||||
}
|
||||
|
||||
static inline void
|
||||
sync_config_and_reply (vcl_test_session_t *conn, vcl_test_cfg_t *rx_cfg)
|
||||
sync_config_and_reply (vcl_test_session_t *conn, hs_test_cfg_t *rx_cfg)
|
||||
{
|
||||
conn->cfg = *rx_cfg;
|
||||
vcl_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */, (uint8_t **) &conn->rxbuf,
|
||||
@ -140,7 +140,7 @@ sync_config_and_reply (vcl_test_session_t *conn, vcl_test_cfg_t *rx_cfg)
|
||||
if (conn->cfg.verbose)
|
||||
{
|
||||
vtinf ("(fd %d): Replying to cfg message!\n", conn->fd);
|
||||
vcl_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
|
||||
hs_test_cfg_dump (&conn->cfg, 0 /* is_client */);
|
||||
}
|
||||
(void) vcl_test_write (conn, &conn->cfg, sizeof (conn->cfg));
|
||||
}
|
||||
@ -185,14 +185,14 @@ vts_wrk_cleanup_all (vcl_test_server_worker_t *wrk)
|
||||
|
||||
static void
|
||||
vts_test_cmd (vcl_test_server_worker_t *wrk, vcl_test_session_t *conn,
|
||||
vcl_test_cfg_t *rx_cfg)
|
||||
hs_test_cfg_t *rx_cfg)
|
||||
{
|
||||
u8 is_bi = rx_cfg->test == VCL_TEST_TYPE_BI;
|
||||
u8 is_bi = rx_cfg->test == HS_TEST_TYPE_BI;
|
||||
vcl_test_session_t *tc;
|
||||
char buf[64];
|
||||
int i;
|
||||
|
||||
if (rx_cfg->cmd == VCL_TEST_CMD_STOP)
|
||||
if (rx_cfg->cmd == HS_TEST_CMD_STOP)
|
||||
{
|
||||
struct timespec stop;
|
||||
clock_gettime (CLOCK_REALTIME, &stop);
|
||||
@ -232,25 +232,25 @@ vts_test_cmd (vcl_test_server_worker_t *wrk, vcl_test_session_t *conn,
|
||||
|
||||
vcl_test_stats_dump ("SERVER RESULTS", &conn->stats, 1 /* show_rx */ ,
|
||||
is_bi /* show_tx */ , conn->cfg.verbose);
|
||||
vcl_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
|
||||
hs_test_cfg_dump (&conn->cfg, 0 /* is_client */);
|
||||
if (conn->cfg.verbose)
|
||||
{
|
||||
vtinf (" vcl server main\n" VCL_TEST_SEPARATOR_STRING
|
||||
vtinf (" vcl server main\n" HS_TEST_SEPARATOR_STRING
|
||||
" buf: %p\n"
|
||||
" buf size: %u (0x%08x)\n" VCL_TEST_SEPARATOR_STRING,
|
||||
" buf size: %u (0x%08x)\n" HS_TEST_SEPARATOR_STRING,
|
||||
conn->rxbuf, conn->rxbuf_size, conn->rxbuf_size);
|
||||
}
|
||||
|
||||
sync_config_and_reply (conn, rx_cfg);
|
||||
memset (&conn->stats, 0, sizeof (conn->stats));
|
||||
}
|
||||
else if (rx_cfg->cmd == VCL_TEST_CMD_SYNC)
|
||||
else if (rx_cfg->cmd == HS_TEST_CMD_SYNC)
|
||||
{
|
||||
rx_cfg->ctrl_handle = conn->fd;
|
||||
vtinf ("Set control fd %d for test!", conn->fd);
|
||||
sync_config_and_reply (conn, rx_cfg);
|
||||
}
|
||||
else if (rx_cfg->cmd == VCL_TEST_CMD_START)
|
||||
else if (rx_cfg->cmd == HS_TEST_CMD_START)
|
||||
{
|
||||
vtinf ("Starting %s-directional Stream Test (fd %d)!",
|
||||
is_bi ? "Bi" : "Uni", conn->fd);
|
||||
@ -268,7 +268,7 @@ vts_server_process_rx (vcl_test_session_t *conn, int rx_bytes)
|
||||
{
|
||||
vcl_test_server_main_t *vsm = &vcl_server_main;
|
||||
|
||||
if (conn->cfg.test == VCL_TEST_TYPE_BI)
|
||||
if (conn->cfg.test == HS_TEST_TYPE_BI)
|
||||
{
|
||||
if (vsm->use_ds)
|
||||
{
|
||||
@ -523,13 +523,13 @@ vcl_test_server_process_opts (vcl_test_server_main_t * vsm, int argc,
|
||||
}
|
||||
|
||||
int
|
||||
vts_handle_ctrl_cfg (vcl_test_server_worker_t *wrk, vcl_test_cfg_t *rx_cfg,
|
||||
vts_handle_ctrl_cfg (vcl_test_server_worker_t *wrk, hs_test_cfg_t *rx_cfg,
|
||||
vcl_test_session_t *conn, int rx_bytes)
|
||||
{
|
||||
if (rx_cfg->verbose)
|
||||
{
|
||||
vtinf ("(fd %d): Received a cfg msg!", conn->fd);
|
||||
vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
|
||||
hs_test_cfg_dump (rx_cfg, 0 /* is_client */);
|
||||
}
|
||||
|
||||
if (rx_bytes != sizeof (*rx_cfg))
|
||||
@ -541,7 +541,7 @@ vts_handle_ctrl_cfg (vcl_test_server_worker_t *wrk, vcl_test_cfg_t *rx_cfg,
|
||||
if (conn->cfg.verbose)
|
||||
{
|
||||
vtinf ("(fd %d): Replying to cfg msg", conn->fd);
|
||||
vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
|
||||
hs_test_cfg_dump (rx_cfg, 0 /* is_client */);
|
||||
}
|
||||
conn->write (conn, &conn->cfg, sizeof (conn->cfg));
|
||||
return -1;
|
||||
@ -549,17 +549,17 @@ vts_handle_ctrl_cfg (vcl_test_server_worker_t *wrk, vcl_test_cfg_t *rx_cfg,
|
||||
|
||||
switch (rx_cfg->test)
|
||||
{
|
||||
case VCL_TEST_TYPE_NONE:
|
||||
case VCL_TEST_TYPE_ECHO:
|
||||
case HS_TEST_TYPE_NONE:
|
||||
case HS_TEST_TYPE_ECHO:
|
||||
sync_config_and_reply (conn, rx_cfg);
|
||||
break;
|
||||
|
||||
case VCL_TEST_TYPE_BI:
|
||||
case VCL_TEST_TYPE_UNI:
|
||||
case HS_TEST_TYPE_BI:
|
||||
case HS_TEST_TYPE_UNI:
|
||||
vts_test_cmd (wrk, conn, rx_cfg);
|
||||
break;
|
||||
|
||||
case VCL_TEST_TYPE_EXIT:
|
||||
case HS_TEST_TYPE_EXIT:
|
||||
vtinf ("Ctrl session fd %d closing!", conn->fd);
|
||||
vts_session_cleanup (conn);
|
||||
wrk->nfds--;
|
||||
@ -570,7 +570,7 @@ vts_handle_ctrl_cfg (vcl_test_server_worker_t *wrk, vcl_test_cfg_t *rx_cfg,
|
||||
|
||||
default:
|
||||
vtwrn ("Unknown test type %d", rx_cfg->test);
|
||||
vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
|
||||
hs_test_cfg_dump (rx_cfg, 0 /* is_client */);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -652,7 +652,7 @@ vts_worker_loop (void *arg)
|
||||
vcl_test_server_worker_t *wrk = arg;
|
||||
vcl_test_session_t *conn;
|
||||
int i, rx_bytes, num_ev;
|
||||
vcl_test_cfg_t *rx_cfg;
|
||||
hs_test_cfg_t *rx_cfg;
|
||||
|
||||
if (wrk->wrk_index)
|
||||
vts_worker_init (wrk);
|
||||
@ -726,8 +726,8 @@ vts_worker_loop (void *arg)
|
||||
if (!wrk->wrk_index && conn->fd == vsm->ctrl->fd)
|
||||
{
|
||||
rx_bytes = conn->read (conn, conn->rxbuf, conn->rxbuf_size);
|
||||
rx_cfg = (vcl_test_cfg_t *) conn->rxbuf;
|
||||
if (rx_cfg->magic == VCL_TEST_CFG_CTRL_MAGIC)
|
||||
rx_cfg = (hs_test_cfg_t *) conn->rxbuf;
|
||||
if (rx_cfg->magic == HS_TEST_CFG_CTRL_MAGIC)
|
||||
{
|
||||
vts_handle_ctrl_cfg (wrk, rx_cfg, conn, rx_bytes);
|
||||
if (!wrk->nfds)
|
||||
@ -855,7 +855,7 @@ main (int argc, char **argv)
|
||||
vts_ctrl_session_init (&vsm->workers[0]);
|
||||
|
||||
/* Update ctrl port to data port */
|
||||
vsm->server_cfg.endpt.port += 1;
|
||||
vsm->server_cfg.endpt.port = hs_make_data_port (vsm->server_cfg.endpt.port);
|
||||
vts_worker_init (&vsm->workers[0]);
|
||||
for (i = 1; i < vsm->server_cfg.workers; i++)
|
||||
{
|
||||
|
@ -139,9 +139,9 @@ class QUICEchoIntTestCase(QUICTestCase):
|
||||
def setUp(self):
|
||||
super(QUICEchoIntTestCase, self).setUp()
|
||||
self.client_args = (
|
||||
f"uri {self.uri} fifo-size 64{self.test_bytes} appns {self.client_appns} "
|
||||
f"uri {self.uri} fifo-size 64k{self.test_bytes} appns {self.client_appns} "
|
||||
)
|
||||
self.server_args = f"uri {self.uri} fifo-size 64 appns {self.server_appns} "
|
||||
self.server_args = f"uri {self.uri} fifo-size 64k appns {self.server_appns} "
|
||||
|
||||
def tearDown(self):
|
||||
super(QUICEchoIntTestCase, self).tearDown()
|
||||
@ -168,7 +168,7 @@ class QUICEchoIntTransferTestCase(QUICEchoIntTestCase):
|
||||
def test_quic_int_transfer(self):
|
||||
"""QUIC internal transfer"""
|
||||
self.server()
|
||||
self.client("no-output", "mbytes", "2")
|
||||
self.client("mbytes", "2")
|
||||
|
||||
|
||||
@tag_fixme_vpp_workers
|
||||
@ -178,11 +178,11 @@ class QUICEchoIntSerialTestCase(QUICEchoIntTestCase):
|
||||
def test_quic_serial_int_transfer(self):
|
||||
"""QUIC serial internal transfer"""
|
||||
self.server()
|
||||
self.client("no-output", "mbytes", "2")
|
||||
self.client("no-output", "mbytes", "2")
|
||||
self.client("no-output", "mbytes", "2")
|
||||
self.client("no-output", "mbytes", "2")
|
||||
self.client("no-output", "mbytes", "2")
|
||||
self.client("mbytes", "2")
|
||||
self.client("mbytes", "2")
|
||||
self.client("mbytes", "2")
|
||||
self.client("mbytes", "2")
|
||||
self.client("mbytes", "2")
|
||||
|
||||
|
||||
@tag_fixme_vpp_workers
|
||||
@ -192,7 +192,7 @@ class QUICEchoIntMStreamTestCase(QUICEchoIntTestCase):
|
||||
def test_quic_int_multistream_transfer(self):
|
||||
"""QUIC internal multi-stream transfer"""
|
||||
self.server()
|
||||
self.client("nclients", "10", "mbytes", "1", "no-output")
|
||||
self.client("nclients", "10", "mbytes", "1")
|
||||
|
||||
|
||||
class QUICEchoExtTestCase(QUICTestCase):
|
||||
|
@ -79,7 +79,7 @@ class TestSession(VppTestCase):
|
||||
# Start builtin server and client with small private segments
|
||||
uri = "tcp://" + self.loop0.local_ip4 + "/1234"
|
||||
error = self.vapi.cli(
|
||||
"test echo server appns 0 fifo-size 64 "
|
||||
"test echo server appns 0 fifo-size 64k "
|
||||
+ "private-segment-size 1m uri "
|
||||
+ uri
|
||||
)
|
||||
@ -89,7 +89,7 @@ class TestSession(VppTestCase):
|
||||
|
||||
error = self.vapi.cli(
|
||||
"test echo client nclients 100 appns 1 "
|
||||
+ "no-output fifo-size 64 syn-timeout 2 "
|
||||
+ "fifo-size 64k syn-timeout 2 "
|
||||
+ "private-segment-size 1m uri "
|
||||
+ uri
|
||||
)
|
||||
|
@ -73,14 +73,14 @@ class TestTCP(VppTestCase):
|
||||
|
||||
# Start builtin server and client
|
||||
uri = "tcp://" + self.loop0.local_ip4 + "/1234"
|
||||
error = self.vapi.cli("test echo server appns 0 fifo-size 4 uri " + uri)
|
||||
error = self.vapi.cli("test echo server appns 0 fifo-size 4k uri " + uri)
|
||||
if error:
|
||||
self.logger.critical(error)
|
||||
self.assertNotIn("failed", error)
|
||||
|
||||
error = self.vapi.cli(
|
||||
"test echo client mbytes 10 appns 1 "
|
||||
+ "fifo-size 4 no-output test-bytes "
|
||||
+ "fifo-size 4k test-bytes "
|
||||
+ "syn-timeout 2 uri "
|
||||
+ uri
|
||||
)
|
||||
|
@ -129,7 +129,7 @@ class TestTLS(VppTestCase):
|
||||
# Start builtin server and client
|
||||
uri = "tls://" + self.loop0.local_ip4 + "/1234"
|
||||
error = self.vapi.cli(
|
||||
"test echo server appns 0 fifo-size 4 tls-engine 1 uri " + uri
|
||||
"test echo server appns 0 fifo-size 4k tls-engine 1 uri " + uri
|
||||
)
|
||||
if error:
|
||||
self.logger.critical(error)
|
||||
@ -137,7 +137,7 @@ class TestTLS(VppTestCase):
|
||||
|
||||
error = self.vapi.cli(
|
||||
"test echo client mbytes 10 appns 1 "
|
||||
"fifo-size 4 no-output test-bytes "
|
||||
"fifo-size 4k test-bytes "
|
||||
"tls-engine 1 "
|
||||
"syn-timeout 2 uri " + uri
|
||||
)
|
||||
|
@ -746,17 +746,15 @@ class TestUDP(VppTestCase):
|
||||
|
||||
# Start builtin server and client
|
||||
uri = "udp://" + self.loop0.local_ip4 + "/1234"
|
||||
error = self.vapi.cli(
|
||||
"test echo server appns 0 fifo-size 4 no-echo" + "uri " + uri
|
||||
)
|
||||
error = self.vapi.cli("test echo server appns 0 fifo-size 4k " + "uri " + uri)
|
||||
if error:
|
||||
self.logger.critical(error)
|
||||
self.assertNotIn("failed", error)
|
||||
|
||||
error = self.vapi.cli(
|
||||
"test echo client mbytes 10 appns 1 "
|
||||
+ "fifo-size 4 no-output test-bytes "
|
||||
+ "syn-timeout 2 no-return uri "
|
||||
+ "fifo-size 4k "
|
||||
+ "syn-timeout 2 uri "
|
||||
+ uri
|
||||
)
|
||||
if error:
|
||||
|
Reference in New Issue
Block a user