1 from asfframework import VppTestRunner
2 from framework import VppTestCase
4 from config import config
7 @unittest.skipIf("stn" in config.excluded_plugins, "Exclude stn plugin tests")
8 class TestStn(VppTestCase):
11 # TODO: actually test the rules by sending packets
14 super(TestStn, cls).setUpClass()
16 cls.create_pg_interfaces(range(2))
17 for i in cls.pg_interfaces:
26 def tearDownClass(cls):
27 for i in cls.pg_interfaces:
30 super(TestStn, cls).tearDownClass()
32 def test_stn_cli(self):
33 """Add, dump and delete stn rule [CLI]"""
36 f"address: {self.pg0.local_ip4}",
38 "next_node: pg0-output",
40 self.vapi.cli(f"stn rule address {self.pg0.local_ip4} interface pg0")
42 reply = self.vapi.cli("show stn rules")
43 for entry in expected:
44 self.assertIn(entry, reply)
46 self.vapi.cli(f"stn rule address {self.pg0.local_ip4} interface pg0 del")
48 def test_stn_vapi(self):
49 """Add, dump and delete stn rule [VAPI]"""
50 self.vapi.stn_add_del_rule(
51 ip_address=self.pg1.local_ip4,
55 self.vapi.stn_rules_dump()
56 self.vapi.stn_add_del_rule(
57 ip_address=self.pg1.local_ip4,
63 if __name__ == "__main__":
64 unittest.main(testRunner=VppTestRunner)