5 from framework import VppTestCase, VppTestRunner
6 from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
9 class TestSCTP(VppTestCase):
10 """ SCTP Test Case """
14 cls.extra_vpp_plugin_config.append("plugin sctp_plugin.so { enable }")
15 super(TestSCTP, cls).setUpClass()
18 def tearDownClass(cls):
19 super(TestSCTP, cls).tearDownClass()
22 super(TestSCTP, self).setUp()
23 self.vapi.session_enable_disable(is_enabled=1)
24 self.vapi.cli("sctp enable")
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=b"0",
42 sw_if_index=self.loop0.sw_if_index)
43 self.vapi.app_namespace_add_del(namespace_id=b"1",
44 sw_if_index=self.loop1.sw_if_index)
47 for i in self.lo_interfaces:
51 self.vapi.session_enable_disable(is_enabled=0)
52 super(TestSCTP, self).tearDown()
54 def test_sctp_transfer(self):
55 """ SCTP 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 = "sctp://" + self.loop0.local_ip4 + "/1234"
71 error = self.vapi.cli("test echo server appns 0 fifo-size 4 " +
74 self.logger.critical(error)
75 self.assertNotIn("failed", error)
77 error = self.vapi.cli("test echo client mbytes 10 no-return " +
80 " no-output test-bytes syn-timeout 3" +
84 self.logger.critical(error)
85 self.assertNotIn("failed", error)
87 # Delete inter-table routes
88 ip_t01.remove_vpp_config()
89 ip_t10.remove_vpp_config()
91 if __name__ == '__main__':
92 unittest.main(testRunner=VppTestRunner)