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(namespace_id="0",
44 sw_if_index=self.loop0.sw_if_index)
45 self.vapi.app_namespace_add_del(namespace_id="1",
46 sw_if_index=self.loop1.sw_if_index)
49 for i in self.lo_interfaces:
54 super(TestSession, self).tearDown()
55 self.vapi.session_enable_disable(is_enable=1)
57 def test_segment_manager_alloc(self):
58 """ Session Segment Manager Multiple Segment Allocation """
60 # Add inter-table routes
61 ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
62 [VppRoutePath("0.0.0.0",
65 ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
66 [VppRoutePath("0.0.0.0",
68 nh_table_id=0)], table_id=1)
69 ip_t01.add_vpp_config()
70 ip_t10.add_vpp_config()
72 # Start builtin server and client with small private segments
73 uri = "tcp://" + self.loop0.local_ip4 + "/1234"
74 error = self.vapi.cli("test echo server appns 0 fifo-size 64 " +
75 "private-segment-size 1m uri " + uri)
77 self.logger.critical(error)
78 self.assertNotIn("failed", error)
80 error = self.vapi.cli("test echo client nclients 100 appns 1 " +
81 "no-output fifo-size 64 syn-timeout 2 " +
82 "private-segment-size 1m uri " + uri)
84 self.logger.critical(error)
85 self.assertNotIn("failed", error)
90 # Delete inter-table routes
91 ip_t01.remove_vpp_config()
92 ip_t10.remove_vpp_config()
95 @tag_fixme_vpp_workers
96 class TestSessionUnitTests(VppTestCase):
97 """ Session Unit Tests Case """
101 super(TestSessionUnitTests, cls).setUpClass()
104 def tearDownClass(cls):
105 super(TestSessionUnitTests, cls).tearDownClass()
108 super(TestSessionUnitTests, self).setUp()
109 self.vapi.session_enable_disable(is_enable=1)
111 def test_session(self):
112 """ Session Unit Tests """
113 error = self.vapi.cli("test session all")
116 self.logger.critical(error)
117 self.assertNotIn("failed", error)
120 super(TestSessionUnitTests, self).tearDown()
121 self.vapi.session_enable_disable(is_enable=0)
125 class TestSegmentManagerTests(VppTestCase):
126 """ SVM Fifo Unit Tests Case """
130 super(TestSegmentManagerTests, cls).setUpClass()
133 def tearDownClass(cls):
134 super(TestSegmentManagerTests, cls).tearDownClass()
137 super(TestSegmentManagerTests, self).setUp()
139 def test_segment_manager(self):
140 """ Segment manager Tests """
141 error = self.vapi.cli("test segment-manager all")
144 self.logger.critical(error)
145 self.assertNotIn("failed", error)
148 super(TestSegmentManagerTests, self).tearDown()
152 class TestSvmFifoUnitTests(VppTestCase):
153 """ SVM Fifo Unit Tests Case """
157 super(TestSvmFifoUnitTests, cls).setUpClass()
160 def tearDownClass(cls):
161 super(TestSvmFifoUnitTests, cls).tearDownClass()
164 super(TestSvmFifoUnitTests, self).setUp()
166 def test_svm_fifo(self):
167 """ SVM Fifo Unit Tests """
168 error = self.vapi.cli("test svm fifo all")
171 self.logger.critical(error)
172 self.assertNotIn("failed", error)
175 super(TestSvmFifoUnitTests, self).tearDown()
177 if __name__ == '__main__':
178 unittest.main(testRunner=VppTestRunner)