summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBrian Russell <brian@graphiant.com>2021-01-19 16:58:14 +0000
committerNeale Ranns <neale@graphiant.com>2021-01-28 10:27:52 +0000
commita1f360647f1c89908294bf06667fba60f4369e8b (patch)
tree709224836919ac1017a4642346389fd959d5c1ac /test
parentc8f3cdf68a4ce4c480f96b9ca0a8f273ab79cd5e (diff)
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 <brian@graphiant.com> Change-Id: I14acedc1bcd12cb320835a36833cd32303c5f793
Diffstat (limited to 'test')
-rw-r--r--test/test_ip6.py47
1 files changed, 24 insertions, 23 deletions
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.