5 from framework import tag_fixme_vpp_workers
6 from framework import VppTestCase, VppTestRunner
7 from framework import tag_run_solo
8 from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
11 @tag_fixme_vpp_workers
12 class TestSession(VppTestCase):
13 """Session Test Case"""
17 super(TestSession, cls).setUpClass()
20 def tearDownClass(cls):
21 super(TestSession, cls).tearDownClass()
24 super(TestSession, self).setUp()
26 self.vapi.session_enable_disable(is_enable=1)
27 self.create_loopback_interfaces(2)
31 for i in self.lo_interfaces:
35 tbl = VppIpTable(self, table_id)
38 i.set_table_ip4(table_id)
42 # Configure namespaces
43 self.vapi.app_namespace_add_del(
44 namespace_id="0", sw_if_index=self.loop0.sw_if_index
46 self.vapi.app_namespace_add_del(
47 namespace_id="1", sw_if_index=self.loop1.sw_if_index
51 for i in self.lo_interfaces:
56 super(TestSession, self).tearDown()
57 self.vapi.session_enable_disable(is_enable=1)
59 def test_segment_manager_alloc(self):
60 """Session Segment Manager Multiple Segment Allocation"""
62 # Add inter-table routes
67 [VppRoutePath("0.0.0.0", 0xFFFFFFFF, nh_table_id=1)],
73 [VppRoutePath("0.0.0.0", 0xFFFFFFFF, nh_table_id=0)],
76 ip_t01.add_vpp_config()
77 ip_t10.add_vpp_config()
79 # Start builtin server and client with small private segments
80 uri = "tcp://" + self.loop0.local_ip4 + "/1234"
81 error = self.vapi.cli(
82 "test echo server appns 0 fifo-size 64 "
83 + "private-segment-size 1m uri "
87 self.logger.critical(error)
88 self.assertNotIn("failed", error)
90 error = self.vapi.cli(
91 "test echo client nclients 100 appns 1 "
92 + "no-output fifo-size 64 syn-timeout 2 "
93 + "private-segment-size 1m uri "
97 self.logger.critical(error)
98 self.assertNotIn("failed", error)
103 # Delete inter-table routes
104 ip_t01.remove_vpp_config()
105 ip_t10.remove_vpp_config()
108 @tag_fixme_vpp_workers
109 class TestSessionUnitTests(VppTestCase):
110 """Session Unit Tests Case"""
114 super(TestSessionUnitTests, cls).setUpClass()
117 def tearDownClass(cls):
118 super(TestSessionUnitTests, cls).tearDownClass()
121 super(TestSessionUnitTests, self).setUp()
122 self.vapi.session_enable_disable(is_enable=1)
124 def test_session(self):
125 """Session Unit Tests"""
126 error = self.vapi.cli("test session all")
129 self.logger.critical(error)
130 self.assertNotIn("failed", error)
133 super(TestSessionUnitTests, self).tearDown()
134 self.vapi.session_enable_disable(is_enable=0)
138 class TestSegmentManagerTests(VppTestCase):
139 """SVM Fifo Unit Tests Case"""
143 super(TestSegmentManagerTests, cls).setUpClass()
146 def tearDownClass(cls):
147 super(TestSegmentManagerTests, cls).tearDownClass()
150 super(TestSegmentManagerTests, self).setUp()
152 def test_segment_manager(self):
153 """Segment manager Tests"""
154 error = self.vapi.cli("test segment-manager all")
157 self.logger.critical(error)
158 self.assertNotIn("failed", error)
161 super(TestSegmentManagerTests, self).tearDown()
165 class TestSvmFifoUnitTests(VppTestCase):
166 """SVM Fifo Unit Tests Case"""
170 super(TestSvmFifoUnitTests, cls).setUpClass()
173 def tearDownClass(cls):
174 super(TestSvmFifoUnitTests, cls).tearDownClass()
177 super(TestSvmFifoUnitTests, self).setUp()
179 def test_svm_fifo(self):
180 """SVM Fifo Unit Tests"""
181 error = self.vapi.cli("test svm fifo all")
184 self.logger.critical(error)
185 self.assertNotIn("failed", error)
188 super(TestSvmFifoUnitTests, self).tearDown()
191 if __name__ == "__main__":
192 unittest.main(testRunner=VppTestRunner)