1 from framework import VppTestCase, VppTestRunner
3 from config import config
6 @unittest.skipIf("stn" in config.excluded_plugins, "Exclude stn plugin tests")
7 class TestStn(VppTestCase):
10 # TODO: actually test the rules by sending packets
13 super(TestStn, cls).setUpClass()
15 cls.create_pg_interfaces(range(2))
16 for i in cls.pg_interfaces:
25 def tearDownClass(cls):
26 for i in cls.pg_interfaces:
29 super(TestStn, cls).tearDownClass()
31 def test_stn_cli(self):
32 """Add, dump and delete stn rule [CLI]"""
35 f"address: {self.pg0.local_ip4}",
37 "next_node: pg0-output",
39 self.vapi.cli(f"stn rule address {self.pg0.local_ip4} interface pg0")
41 reply = self.vapi.cli("show stn rules")
42 for entry in expected:
43 self.assertIn(entry, reply)
45 self.vapi.cli(f"stn rule address {self.pg0.local_ip4} interface pg0 del")
47 def test_stn_vapi(self):
48 """Add, dump and delete stn rule [VAPI]"""
49 self.vapi.stn_add_del_rule(
50 ip_address=self.pg1.local_ip4,
54 self.vapi.stn_rules_dump()
55 self.vapi.stn_add_del_rule(
56 ip_address=self.pg1.local_ip4,
62 if __name__ == "__main__":
63 unittest.main(testRunner=VppTestRunner)