5 from asfframework import (
11 from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
14 @tag_fixme_vpp_workers
15 class TestSession(VppAsfTestCase):
16 """Session Test Case"""
20 super(TestSession, cls).setUpClass()
23 def tearDownClass(cls):
24 super(TestSession, cls).tearDownClass()
27 super(TestSession, self).setUp()
29 self.vapi.session_enable_disable(is_enable=1)
30 self.create_loopback_interfaces(2)
34 for i in self.lo_interfaces:
38 tbl = VppIpTable(self, table_id)
41 i.set_table_ip4(table_id)
45 # Configure namespaces
46 self.vapi.app_namespace_add_del_v4(
47 namespace_id="0", sw_if_index=self.loop0.sw_if_index
49 self.vapi.app_namespace_add_del_v4(
50 namespace_id="1", sw_if_index=self.loop1.sw_if_index
54 for i in self.lo_interfaces:
59 super(TestSession, self).tearDown()
60 self.vapi.session_enable_disable(is_enable=1)
62 def test_segment_manager_alloc(self):
63 """Session Segment Manager Multiple Segment Allocation"""
65 # Add inter-table routes
70 [VppRoutePath("0.0.0.0", 0xFFFFFFFF, nh_table_id=1)],
76 [VppRoutePath("0.0.0.0", 0xFFFFFFFF, nh_table_id=0)],
79 ip_t01.add_vpp_config()
80 ip_t10.add_vpp_config()
82 # Start builtin server and client with small private segments
83 uri = "tcp://" + self.loop0.local_ip4 + "/1234"
84 error = self.vapi.cli(
85 "test echo server appns 0 fifo-size 64k "
86 + "private-segment-size 1m uri "
90 self.logger.critical(error)
91 self.assertNotIn("failed", error)
93 error = self.vapi.cli(
94 "test echo client nclients 100 appns 1 "
95 + "fifo-size 64k syn-timeout 2 "
96 + "private-segment-size 1m uri "
100 self.logger.critical(error)
101 self.assertNotIn("failed", error)
106 # Delete inter-table routes
107 ip_t01.remove_vpp_config()
108 ip_t10.remove_vpp_config()
111 @tag_fixme_vpp_workers
112 class TestSessionUnitTests(VppAsfTestCase):
113 """Session Unit Tests Case"""
117 super(TestSessionUnitTests, cls).setUpClass()
120 def tearDownClass(cls):
121 super(TestSessionUnitTests, cls).tearDownClass()
124 super(TestSessionUnitTests, self).setUp()
125 self.vapi.session_enable_disable(is_enable=1)
127 def test_session(self):
128 """Session Unit Tests"""
129 error = self.vapi.cli("test session all")
132 self.logger.critical(error)
133 self.assertNotIn("failed", error)
136 super(TestSessionUnitTests, self).tearDown()
137 self.vapi.session_enable_disable(is_enable=0)
141 class TestSegmentManagerTests(VppAsfTestCase):
142 """SVM Fifo Unit Tests Case"""
146 super(TestSegmentManagerTests, cls).setUpClass()
149 def tearDownClass(cls):
150 super(TestSegmentManagerTests, cls).tearDownClass()
153 super(TestSegmentManagerTests, self).setUp()
155 def test_segment_manager(self):
156 """Segment manager Tests"""
157 error = self.vapi.cli("test segment-manager all")
160 self.logger.critical(error)
161 self.assertNotIn("failed", error)
164 super(TestSegmentManagerTests, self).tearDown()
168 class TestSvmFifoUnitTests(VppAsfTestCase):
169 """SVM Fifo Unit Tests Case"""
173 super(TestSvmFifoUnitTests, cls).setUpClass()
176 def tearDownClass(cls):
177 super(TestSvmFifoUnitTests, cls).tearDownClass()
180 super(TestSvmFifoUnitTests, self).setUp()
182 def test_svm_fifo(self):
183 """SVM Fifo Unit Tests"""
184 error = self.vapi.cli("test svm fifo all")
187 self.logger.critical(error)
188 self.assertNotIn("failed", error)
191 super(TestSvmFifoUnitTests, self).tearDown()
194 if __name__ == "__main__":
195 unittest.main(testRunner=VppTestRunner)