5 from framework import tag_fixme_vpp_workers
6 from framework import VppTestCase, VppTestRunner
7 from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
10 @tag_fixme_vpp_workers
11 class TestTCP(VppTestCase):
16 super(TestTCP, cls).setUpClass()
19 def tearDownClass(cls):
20 super(TestTCP, cls).tearDownClass()
23 super(TestTCP, self).setUp()
24 self.vapi.session_enable_disable(is_enable=1)
25 self.create_loopback_interfaces(2)
29 for i in self.lo_interfaces:
33 tbl = VppIpTable(self, table_id)
36 i.set_table_ip4(table_id)
40 # Configure namespaces
41 self.vapi.app_namespace_add_del(namespace_id="0",
42 sw_if_index=self.loop0.sw_if_index)
43 self.vapi.app_namespace_add_del(namespace_id="1",
44 sw_if_index=self.loop1.sw_if_index)
47 for i in self.lo_interfaces:
51 self.vapi.session_enable_disable(is_enable=0)
52 super(TestTCP, self).tearDown()
54 def test_tcp_transfer(self):
55 """ TCP echo client/server transfer """
57 # Add inter-table routes
58 ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
59 [VppRoutePath("0.0.0.0",
62 ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
63 [VppRoutePath("0.0.0.0",
65 nh_table_id=0)], table_id=1)
66 ip_t01.add_vpp_config()
67 ip_t10.add_vpp_config()
69 # Start builtin server and client
70 uri = "tcp://" + self.loop0.local_ip4 + "/1234"
71 error = self.vapi.cli("test echo server appns 0 fifo-size 4 uri " +
74 self.logger.critical(error)
75 self.assertNotIn("failed", error)
77 error = self.vapi.cli("test echo client mbytes 10 appns 1 " +
78 "fifo-size 4 no-output test-bytes " +
79 "syn-timeout 2 uri " + uri)
81 self.logger.critical(error)
82 self.assertNotIn("failed", error)
84 # Delete inter-table routes
85 ip_t01.remove_vpp_config()
86 ip_t10.remove_vpp_config()
89 class TestTCPUnitTests(VppTestCase):
94 super(TestTCPUnitTests, cls).setUpClass()
97 def tearDownClass(cls):
98 super(TestTCPUnitTests, cls).tearDownClass()
101 super(TestTCPUnitTests, self).setUp()
102 self.vapi.session_enable_disable(is_enable=1)
105 super(TestTCPUnitTests, self).tearDown()
106 self.vapi.session_enable_disable(is_enable=0)
108 def test_tcp_unittest(self):
109 """ TCP Unit Tests """
110 error = self.vapi.cli("test tcp all")
113 self.logger.critical(error)
114 self.assertNotIn("failed", error)
116 if __name__ == '__main__':
117 unittest.main(testRunner=VppTestRunner)