summaryrefslogtreecommitdiffstats
path: root/test/test_vcl.py
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2018-03-20 09:22:13 -0400
committerFlorin Coras <florin.coras@gmail.com>2018-03-26 21:56:16 +0000
commitde91006803f823a149b04738dd2bbfe18bfe9791 (patch)
tree9e7d3090dc6c0926a5fc72d5f908fd1da4a88c3c /test/test_vcl.py
parent0a15e8c3b6a7e19131f7abc6fd4d1422616cda5c (diff)
VCL: add IPv6 to socket_test.sh and make test
Change-Id: If3827828062a46f1cce43642535333f677f06e62 Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'test/test_vcl.py')
-rw-r--r--test/test_vcl.py412
1 files changed, 386 insertions, 26 deletions
diff --git a/test/test_vcl.py b/test/test_vcl.py
index 73537f6dfc3..b427c945383 100644
--- a/test/test_vcl.py
+++ b/test/test_vcl.py
@@ -41,6 +41,8 @@ class VCLTestCase(VppTestCase):
self.server_addr = "127.0.0.1"
self.server_port = "22000"
self.server_args = [self.server_port]
+ self.server_ipv6_addr = "::1"
+ self.server_ipv6_args = ["-6", self.server_port]
self.timeout = 3
self.echo_phrase = "Hello, world! Jenny is a friend of mine."
@@ -112,6 +114,50 @@ class VCLTestCase(VppTestCase):
self.vapi.session_enable_disable(is_enabled=0)
+ def thru_host_stack_ipv6_setup(self):
+ self.vapi.session_enable_disable(is_enabled=1)
+ self.create_loopback_interfaces(range(2))
+
+ table_id = 1
+
+ for i in self.lo_interfaces:
+ i.admin_up()
+
+ tbl = VppIpTable(self, table_id, is_ip6=1)
+ tbl.add_vpp_config()
+
+ i.set_table_ip6(table_id)
+ i.config_ip6()
+ table_id += 1
+
+ # Configure namespaces
+ self.vapi.app_namespace_add(namespace_id="0", secret=1234,
+ sw_if_index=self.loop0.sw_if_index)
+ self.vapi.app_namespace_add(namespace_id="1", secret=5678,
+ sw_if_index=self.loop1.sw_if_index)
+
+ # Add inter-table routes
+ ip_t01 = VppIpRoute(self, self.loop1.local_ip6, 128,
+ [VppRoutePath("0.0.0.0", 0xffffffff,
+ nh_table_id=2)],
+ table_id=1, is_ip6=1)
+ ip_t10 = VppIpRoute(self, self.loop0.local_ip6, 128,
+ [VppRoutePath("0.0.0.0", 0xffffffff,
+ nh_table_id=1)],
+ table_id=2, is_ip6=1)
+ ip_t01.add_vpp_config()
+ ip_t10.add_vpp_config()
+ self.logger.debug(self.vapi.cli("show interface addr"))
+ self.logger.debug(self.vapi.cli("show ip6 fib"))
+
+ def thru_host_stack_ipv6_tear_down(self):
+ for i in self.lo_interfaces:
+ i.unconfig_ip6()
+ i.set_table_ip6(0)
+ i.admin_down()
+
+ self.vapi.session_enable_disable(is_enabled=0)
+
def thru_host_stack_test(self, server_app, server_args,
client_app, client_args):
self.env = {'VCL_API_PREFIX': self.shm_prefix,
@@ -170,19 +216,19 @@ class VCLCutThruTestCase(VCLTestCase):
super(VCLCutThruTestCase, self).setUp()
self.cut_thru_setup()
- self.client_echo_test_args = [self.server_addr, self.server_port,
- "-E", self.echo_phrase, "-X"]
+ self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
+ self.server_addr, self.server_port]
self.client_iperf3_timeout = 20
self.client_iperf3_args = ["-V4d", "-c", self.server_addr]
self.server_iperf3_args = ["-V4d", "-s"]
self.client_uni_dir_nsock_timeout = 60
- self.client_uni_dir_nsock_test_args = [self.server_addr,
- self.server_port,
- "-I", "5", "-U", "-X"]
+ self.client_uni_dir_nsock_test_args = ["-I", "5", "-U", "-X",
+ self.server_addr,
+ self.server_port]
self.client_bi_dir_nsock_timeout = 120
- self.client_bi_dir_nsock_test_args = [self.server_addr,
- self.server_port,
- "-I", "2", "-B", "-X"]
+ self.client_bi_dir_nsock_test_args = ["-I", "2", "-B", "-X",
+ self.server_addr,
+ self.server_port]
def tearDown(self):
self.cut_thru_tear_down()
@@ -259,9 +305,9 @@ class VCLThruHostStackTestCase(VCLTestCase):
super(VCLThruHostStackTestCase, self).setUp()
self.thru_host_stack_setup()
- self.client_echo_test_args = [self.loop0.local_ip4,
- self.server_port,
- "-E", self.echo_phrase, "-X"]
+ self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
+ self.loop0.local_ip4,
+ self.server_port]
def tearDown(self):
self.thru_host_stack_tear_down()
@@ -301,11 +347,14 @@ class VCLThruHostStackExtendedATestCase(VCLTestCase):
self.thru_host_stack_setup()
if self.vppDebug:
self.client_bi_dir_nsock_timeout = 120
+ self.client_bi_dir_nsock_test_args = ["-B", "-X",
+ self.loop0.local_ip4,
+ self.server_port]
else:
- self.client_bi_dir_nsock_timeout = 60
- self.client_bi_dir_nsock_test_args = [self.loop0.local_ip4,
- self.server_port,
- "-I", "2", "-B", "-X"]
+ self.client_bi_dir_nsock_timeout = 90
+ self.client_bi_dir_nsock_test_args = ["-I", "2", "-B", "-X",
+ self.loop0.local_ip4,
+ self.server_port]
def tearDown(self):
self.thru_host_stack_tear_down()
@@ -331,11 +380,14 @@ class VCLThruHostStackExtendedBTestCase(VCLTestCase):
self.thru_host_stack_setup()
if self.vppDebug:
self.client_bi_dir_nsock_timeout = 120
+ self.client_bi_dir_nsock_test_args = ["-B", "-X",
+ self.loop0.local_ip4,
+ self.server_port]
else:
self.client_bi_dir_nsock_timeout = 60
- self.client_bi_dir_nsock_test_args = [self.loop0.local_ip4,
- self.server_port,
- "-I", "2", "-B", "-X"]
+ self.client_bi_dir_nsock_test_args = ["-I", "2", "-B", "-X",
+ self.loop0.local_ip4,
+ self.server_port]
def tearDown(self):
self.thru_host_stack_tear_down()
@@ -366,10 +418,10 @@ class VCLThruHostStackExtendedCTestCase(VCLTestCase):
self.client_uni_dir_nsock_timeout = 120
self.numSockets = "5"
- self.client_uni_dir_nsock_test_args = [self.loop0.local_ip4,
- self.server_port,
- "-I", self.numSockets,
- "-U", "-X"]
+ self.client_uni_dir_nsock_test_args = ["-I", self.numSockets,
+ "-U", "-X",
+ self.loop0.local_ip4,
+ self.server_port]
def tearDown(self):
self.thru_host_stack_tear_down()
@@ -400,10 +452,10 @@ class VCLThruHostStackExtendedDTestCase(VCLTestCase):
self.client_uni_dir_nsock_timeout = 120
self.numSockets = "5"
- self.client_uni_dir_nsock_test_args = [self.loop0.local_ip4,
- self.server_port,
- "-I", self.numSockets,
- "-U", "-X"]
+ self.client_uni_dir_nsock_test_args = ["-I", self.numSockets,
+ "-U", "-X",
+ self.loop0.local_ip4,
+ self.server_port]
def tearDown(self):
self.thru_host_stack_tear_down()
@@ -452,5 +504,313 @@ class VCLThruHostStackIperfTestCase(VCLTestCase):
"iperf3", self.client_iperf3_args)
+class VCLIpv6CutThruTestCase(VCLTestCase):
+ """ VCL IPv6 Cut Thru Tests """
+
+ def setUp(self):
+ super(VCLIpv6CutThruTestCase, self).setUp()
+
+ self.cut_thru_setup()
+ self.client_iperf3_timeout = 20
+ self.client_uni_dir_nsock_timeout = 60
+ self.client_bi_dir_nsock_timeout = 120
+ self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
+ self.server_ipv6_addr,
+ self.server_port]
+ self.client_ipv6_iperf3_args = ["-V6d", "-c", self.server_ipv6_addr]
+ self.server_ipv6_iperf3_args = ["-V6d", "-s"]
+ self.client_ipv6_uni_dir_nsock_test_args = ["-6", "-I", "5",
+ "-U", "-X",
+ self.server_ipv6_addr,
+ self.server_port]
+ self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-I", "2",
+ "-B", "-X",
+ self.server_ipv6_addr,
+ self.server_port]
+
+ def tearDown(self):
+ self.cut_thru_tear_down()
+
+ super(VCLIpv6CutThruTestCase, self).tearDown()
+
+ def test_ldp_ipv6_cut_thru_echo(self):
+ """ run LDP IPv6 cut thru echo test """
+
+ self.cut_thru_test("sock_test_server",
+ self.server_ipv6_args,
+ "sock_test_client",
+ self.client_ipv6_echo_test_args)
+
+ def test_ldp_ipv6_cut_thru_iperf3(self):
+ """ run LDP IPv6 cut thru iperf3 test """
+
+ try:
+ subprocess.check_output(['iperf3', '-v'])
+ except:
+ self.logger.error("WARNING: 'iperf3' is not installed,")
+ self.logger.error(
+ " 'test_ldp_ipv6_cut_thru_iperf3' not run!")
+ return
+
+ self.timeout = self.client_iperf3_timeout
+ self.cut_thru_test("iperf3", self.server_ipv6_iperf3_args,
+ "iperf3", self.client_ipv6_iperf3_args)
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
+ """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """
+
+ self.timeout = self.client_uni_dir_nsock_timeout
+ self.cut_thru_test("sock_test_server", self.server_ipv6_args,
+ "sock_test_client",
+ self.client_ipv6_uni_dir_nsock_test_args)
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
+ """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """
+
+ self.timeout = self.client_bi_dir_nsock_timeout
+ self.cut_thru_test("sock_test_server", self.server_ipv6_args,
+ "sock_test_client",
+ self.client_ipv6_bi_dir_nsock_test_args)
+
+ def test_vcl_ipv6_cut_thru_echo(self):
+ """ run VCL IPv6 cut thru echo test """
+
+ self.cut_thru_test("vcl_test_server",
+ self.server_ipv6_args,
+ "vcl_test_client",
+ self.client_ipv6_echo_test_args)
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
+ """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """
+
+ self.timeout = self.client_uni_dir_nsock_timeout
+ self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
+ "vcl_test_client",
+ self.client_ipv6_uni_dir_nsock_test_args)
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
+ """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """
+
+ self.timeout = self.client_bi_dir_nsock_timeout
+ self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
+ "vcl_test_client",
+ self.client_ipv6_bi_dir_nsock_test_args)
+
+
+class VCLIpv6ThruHostStackTestCase(VCLTestCase):
+ """ VCL IPv6 Thru Host Stack Tests """
+
+ def setUp(self):
+ super(VCLIpv6ThruHostStackTestCase, self).setUp()
+
+ self.thru_host_stack_ipv6_setup()
+ self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
+ self.loop0.local_ip6,
+ self.server_port]
+
+ def tearDown(self):
+ self.thru_host_stack_ipv6_tear_down()
+
+ super(VCLIpv6ThruHostStackTestCase, self).tearDown()
+
+ def test_ldp_ipv6_thru_host_stack_echo(self):
+ """ run LDP IPv6 thru host stack echo test """
+
+ self.thru_host_stack_test("sock_test_server", self.server_ipv6_args,
+ "sock_test_client",
+ self.client_ipv6_echo_test_args)
+ # TBD: Remove these when VPP thru host teardown config bug is fixed.
+ self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args,
+ "vcl_test_client",
+ self.client_ipv6_echo_test_args)
+
+ def test_vcl_ipv6_thru_host_stack_echo(self):
+ """ run VCL IPv6 thru host stack echo test """
+
+ # TBD: Enable this when VPP IPv6 thru host teardown
+ # config bug is fixed.
+ # self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args,
+ # "vcl_test_client",
+ # self.client_ipv6_echo_test_args)
+
+ # TBD: Remove VCLIpv6ThruHostStackExtended*TestCase classes and move
+ # tests here when VPP thru host teardown/setup config bug
+ # is fixed.
+
+
+class VCLIpv6ThruHostStackExtendedATestCase(VCLTestCase):
+ """ VCL IPv6 Thru Host Stack Extended Tests """
+
+ def setUp(self):
+ super(VCLIpv6ThruHostStackExtendedATestCase, self).setUp()
+
+ self.thru_host_stack_ipv6_setup()
+ if self.vppDebug:
+ self.client_bi_dir_nsock_timeout = 120
+ self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-B", "-X",
+ self.loop0.local_ip6,
+ self.server_port]
+ else:
+ self.client_bi_dir_nsock_timeout = 90
+ self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-I",
+ "2", "-B", "-X",
+ self.loop0.local_ip6,
+ self.server_port]
+
+ def tearDown(self):
+ self.thru_host_stack_ipv6_tear_down()
+
+ super(VCLIpv6ThruHostStackExtendedATestCase, self).tearDown()
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_vcl_thru_host_stack_bi_dir_nsock(self):
+ """ run VCL thru host stack bi-directional (multiple sockets) test """
+
+ self.timeout = self.client_bi_dir_nsock_timeout
+ self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args,
+ "vcl_test_client",
+ self.client_ipv6_bi_dir_nsock_test_args)
+
+
+class VCLIpv6ThruHostStackExtendedBTestCase(VCLTestCase):
+ """ VCL IPv6 Thru Host Stack Extended Tests """
+
+ def setUp(self):
+ super(VCLIpv6ThruHostStackExtendedBTestCase, self).setUp()
+
+ self.thru_host_stack_ipv6_setup()
+ if self.vppDebug:
+ self.client_bi_dir_nsock_timeout = 120
+ self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-B", "-X",
+ self.loop0.local_ip6,
+ self.server_port]
+ else:
+ self.client_bi_dir_nsock_timeout = 60
+ self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-I", "2",
+ "-B", "-X",
+ self.loop0.local_ip6,
+ self.server_port]
+
+ def tearDown(self):
+ self.thru_host_stack_ipv6_tear_down()
+
+ super(VCLIpv6ThruHostStackExtendedBTestCase, self).tearDown()
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_ldp_thru_host_stack_bi_dir_nsock(self):
+ """ run LDP thru host stack bi-directional (multiple sockets) test """
+
+ self.timeout = self.client_bi_dir_nsock_timeout
+ self.thru_host_stack_test("sock_test_server", self.server_ipv6_args,
+ "sock_test_client",
+ self.client_ipv6_bi_dir_nsock_test_args)
+
+
+class VCLIpv6ThruHostStackExtendedCTestCase(VCLTestCase):
+ """ VCL IPv6 Thru Host Stack Extended Tests """
+
+ def setUp(self):
+ super(VCLIpv6ThruHostStackExtendedCTestCase, self).setUp()
+
+ self.thru_host_stack_ipv6_setup()
+ if self.vppDebug:
+ self.client_uni_dir_nsock_timeout = 120
+ self.numSockets = "2"
+ else:
+ self.client_uni_dir_nsock_timeout = 120
+ self.numSockets = "5"
+
+ self.client_ipv6_uni_dir_nsock_test_args = ["-6",
+ "-I", self.numSockets,
+ "-U", "-X",
+ self.loop0.local_ip6,
+ self.server_port]
+
+ def tearDown(self):
+ self.thru_host_stack_ipv6_tear_down()
+
+ super(VCLIpv6ThruHostStackExtendedCTestCase, self).tearDown()
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_ldp_thru_host_stack_uni_dir_nsock(self):
+ """ run LDP thru host stack uni-directional (multiple sockets) test """
+
+ self.timeout = self.client_uni_dir_nsock_timeout
+ self.thru_host_stack_test("sock_test_server", self.server_ipv6_args,
+ "sock_test_client",
+ self.client_ipv6_uni_dir_nsock_test_args)
+
+
+class VCLIpv6ThruHostStackExtendedDTestCase(VCLTestCase):
+ """ VCL IPv6 Thru Host Stack Extended Tests """
+
+ def setUp(self):
+ super(VCLIpv6ThruHostStackExtendedDTestCase, self).setUp()
+
+ self.thru_host_stack_ipv6_setup()
+ if self.vppDebug:
+ self.client_uni_dir_nsock_timeout = 120
+ self.numSockets = "2"
+ else:
+ self.client_uni_dir_nsock_timeout = 120
+ self.numSockets = "5"
+
+ self.client_ipv6_uni_dir_nsock_test_args = ["-6",
+ "-I", self.numSockets,
+ "-U", "-X",
+ self.loop0.local_ip6,
+ self.server_port]
+
+ def tearDown(self):
+ self.thru_host_stack_ipv6_tear_down()
+
+ super(VCLIpv6ThruHostStackExtendedDTestCase, self).tearDown()
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_vcl_thru_host_stack_uni_dir_nsock(self):
+ """ run VCL thru host stack uni-directional (multiple sockets) test """
+
+ self.timeout = self.client_uni_dir_nsock_timeout
+ self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args,
+ "vcl_test_client",
+ self.client_ipv6_uni_dir_nsock_test_args)
+
+
+class VCLIpv6ThruHostStackIperfTestCase(VCLTestCase):
+ """ VCL IPv6 Thru Host Stack Iperf Tests """
+
+ def setUp(self):
+ super(VCLIpv6ThruHostStackIperfTestCase, self).setUp()
+
+ self.thru_host_stack_ipv6_setup()
+ self.client_iperf3_timeout = 20
+ self.client_ipv6_iperf3_args = ["-V6d", "-c", self.loop0.local_ip6]
+ self.server_ipv6_iperf3_args = ["-V6d", "-s"]
+
+ def tearDown(self):
+ self.thru_host_stack_ipv6_tear_down()
+
+ super(VCLIpv6ThruHostStackIperfTestCase, self).tearDown()
+
+ def test_ldp_thru_host_stack_iperf3(self):
+ """ run LDP thru host stack iperf3 test """
+
+ try:
+ subprocess.check_output(['iperf3', '-v'])
+ except:
+ self.logger.error("WARNING: 'iperf3' is not installed,")
+ self.logger.error(
+ " 'test_ldp_thru_host_stack_iperf3' not run!")
+ return
+
+ self.timeout = self.client_iperf3_timeout
+ self.thru_host_stack_test("iperf3", self.server_ipv6_iperf3_args,
+ "iperf3", self.client_ipv6_iperf3_args)
+
+
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)