vcl: add http support to vcl_test_protos

Type: improvement

Change-Id: Ibb493f1d7713d0e10b8bd1d5ff17b89967b53b8a
Signed-off-by: Aritra Basu <aritrbas@cisco.com>
This commit is contained in:
Aritra Basu
2024-08-28 14:02:34 -07:00
committed by Florin Coras
parent 0acb398d6d
commit 70d2a08e7e
7 changed files with 501 additions and 11 deletions

View File

@@ -1,14 +1,15 @@
package main
import (
. "fd.io/hs-test/infra"
"fmt"
"time"
. "fd.io/hs-test/infra"
)
func init() {
RegisterVethTests(XEchoVclClientUdpTest, XEchoVclClientTcpTest, XEchoVclServerUdpTest,
XEchoVclServerTcpTest, VclEchoTcpTest, VclEchoUdpTest, VclRetryAttachTest)
XEchoVclServerTcpTest, VclEchoTcpTest, VclEchoUdpTest, VclHttpPostTest, VclRetryAttachTest)
}
func getVclConfig(c *Container, ns_id_optional ...string) string {
@@ -89,7 +90,7 @@ func testVclEcho(s *VethsSuite, proto string) {
srvAppCont.CreateFile("/vcl.conf", getVclConfig(srvVppCont))
srvAppCont.AddEnvVar("VCL_CONFIG", "/vcl.conf")
srvAppCont.ExecServer("vcl_test_server " + port)
srvAppCont.ExecServer("vcl_test_server -p " + proto + " " + port)
serverVeth := s.GetInterfaceByName(ServerInterfaceName)
serverVethAddress := serverVeth.Ip4AddressString()
@@ -111,6 +112,10 @@ func VclEchoUdpTest(s *VethsSuite) {
testVclEcho(s, "udp")
}
func VclHttpPostTest(s *VethsSuite) {
testVclEcho(s, "http")
}
func VclRetryAttachTest(s *VethsSuite) {
testRetryAttach(s, "tcp")
}

View File

@@ -124,7 +124,7 @@ typedef struct
typedef struct
{
const vcl_test_proto_vft_t *protos[VPPCOM_PROTO_SRTP + 1];
const vcl_test_proto_vft_t *protos[VPPCOM_PROTO_HTTP + 1];
uint32_t ckpair_index;
hs_test_cfg_t cfg;
vcl_test_wrk_t *wrk;

View File

@@ -419,13 +419,8 @@ vtc_worker_run_select (vcl_test_client_worker_t *wrk)
if (vcm->incremental_stats)
vtc_inc_stats_check (ts);
}
if ((!check_rx && ts->stats.tx_bytes >= ts->cfg.total_bytes) ||
(check_rx && ts->stats.rx_bytes >= ts->cfg.total_bytes))
{
clock_gettime (CLOCK_REALTIME, &ts->stats.stop);
ts->is_done = 1;
n_active_sessions--;
}
if (vtc_session_check_is_done (ts, check_rx))
n_active_sessions -= 1;
}
}

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1754,6 +1754,10 @@ vppcom_unformat_proto (uint8_t * proto, char *proto_str)
*proto = VPPCOM_PROTO_SRTP;
else if (!strcmp (proto_str, "srtp"))
*proto = VPPCOM_PROTO_SRTP;
else if (!strcmp (proto_str, "HTTP"))
*proto = VPPCOM_PROTO_HTTP;
else if (!strcmp (proto_str, "http"))
*proto = VPPCOM_PROTO_HTTP;
else
return 1;
return 0;
@@ -4708,6 +4712,9 @@ vppcom_proto_str (vppcom_proto_t proto)
case VPPCOM_PROTO_SRTP:
proto_str = "SRTP";
break;
case VPPCOM_PROTO_HTTP:
proto_str = "HTTP";
break;
default:
proto_str = "UNKNOWN";
break;

View File

@@ -58,6 +58,7 @@ typedef enum vppcom_proto_
VPPCOM_PROTO_QUIC,
VPPCOM_PROTO_DTLS,
VPPCOM_PROTO_SRTP,
VPPCOM_PROTO_HTTP,
} vppcom_proto_t;
typedef enum

View File

@@ -757,6 +757,59 @@ class VCLThruHostStackQUIC(VCLTestCase):
self.logger.debug(self.vapi.cli("show app mq"))
@unittest.skipIf(
"hs_apps" in config.excluded_plugins, "Exclude tests requiring hs_apps plugin"
)
class VCLThruHostStackHTTPPost(VCLTestCase):
"""VCL Thru Host Stack HTTP Post"""
@classmethod
def setUpClass(cls):
cls.extra_vpp_plugin_config.append("plugin http_plugin.so { enable }")
super(VCLThruHostStackHTTPPost, cls).setUpClass()
@classmethod
def tearDownClass(cls):
super(VCLThruHostStackHTTPPost, cls).tearDownClass()
def setUp(self):
super(VCLThruHostStackHTTPPost, self).setUp()
self.thru_host_stack_setup()
self.client_uni_dir_http_post_timeout = 20
self.server_http_post_args = ["-p", "http", self.server_port]
self.client_uni_dir_http_post_test_args = [
"-N",
"10000",
"-U",
"-X",
"-p",
"http",
self.loop0.local_ip4,
self.server_port,
]
def test_vcl_thru_host_stack_http_post_uni_dir(self):
"""run VCL thru host stack uni-directional HTTP POST test"""
self.timeout = self.client_uni_dir_http_post_timeout
self.thru_host_stack_test(
"vcl_test_server",
self.server_http_post_args,
"vcl_test_client",
self.client_uni_dir_http_post_test_args,
)
def tearDown(self):
self.thru_host_stack_tear_down()
super(VCLThruHostStackHTTPPost, self).tearDown()
def show_commands_at_teardown(self):
self.logger.debug(self.vapi.cli("show app server"))
self.logger.debug(self.vapi.cli("show session verbose 2"))
self.logger.debug(self.vapi.cli("show app mq"))
@unittest.skipIf(
"hs_apps" in config.excluded_plugins, "Exclude tests requiring hs_apps plugin"
)