From a1f360647f1c89908294bf06667fba60f4369e8b Mon Sep 17 00:00:00 2001 From: Brian Russell Date: Tue, 19 Jan 2021 16:58:14 +0000 Subject: tests: move ip6 punt setup to its own class Move interface and packet setup for the ip6 punt test to its own class so that child classes can be created that use it. Type: test Signed-off-by: Brian Russell Change-Id: I14acedc1bcd12cb320835a36833cd32303c5f793 --- test/test_ip6.py | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'test') diff --git a/test/test_ip6.py b/test/test_ip6.py index 1b3b9d0a1e6..a9244bd3d60 100644 --- a/test/test_ip6.py +++ b/test/test_ip6.py @@ -2179,20 +2179,10 @@ class TestIP6LoadBalance(VppTestCase): self.send_and_expect_one_itf(self.pg0, port_pkts, self.pg3) -class TestIP6Punt(VppTestCase): - """ IPv6 Punt Police/Redirect """ - - @classmethod - def setUpClass(cls): - super(TestIP6Punt, cls).setUpClass() - - @classmethod - def tearDownClass(cls): - super(TestIP6Punt, cls).tearDownClass() - - def setUp(self): - super(TestIP6Punt, self).setUp() +class IP6PuntSetup(object): + """ Setup for IPv6 Punt Police/Redirect """ + def punt_setup(self): self.create_pg_interfaces(range(4)) for i in self.pg_interfaces: @@ -2200,23 +2190,34 @@ class TestIP6Punt(VppTestCase): i.config_ip6() i.resolve_ndp() - def tearDown(self): - super(TestIP6Punt, self).tearDown() + self.pkt = (Ether(src=self.pg0.remote_mac, + dst=self.pg0.local_mac) / + IPv6(src=self.pg0.remote_ip6, + dst=self.pg0.local_ip6) / + inet6.TCP(sport=1234, dport=1234) / + Raw(b'\xa5' * 100)) + + def punt_teardown(self): for i in self.pg_interfaces: i.unconfig_ip6() i.admin_down() + +class TestIP6Punt(IP6PuntSetup, VppTestCase): + """ IPv6 Punt Police/Redirect """ + + def setUp(self): + super(TestIP6Punt, self).setUp() + super(TestIP6Punt, self).punt_setup() + + def tearDown(self): + super(TestIP6Punt, self).punt_teardown() + super(TestIP6Punt, self).tearDown() + def test_ip_punt(self): """ IP6 punt police and redirect """ - p = (Ether(src=self.pg0.remote_mac, - dst=self.pg0.local_mac) / - IPv6(src=self.pg0.remote_ip6, - dst=self.pg0.local_ip6) / - inet6.TCP(sport=1234, dport=1234) / - Raw(b'\xa5' * 100)) - - pkts = p * 1025 + pkts = self.pkt * 1025 # # Configure a punt redirect via pg1. -- cgit 1.2.3-korg