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
diff --git a/test/test_ip6.py b/test/test_ip6.py
index 1b3b9d0..a9244bd 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -2179,20 +2179,10 @@
         self.send_and_expect_one_itf(self.pg0, port_pkts, self.pg3)
 
 
-class TestIP6Punt(VppTestCase):
-    """ IPv6 Punt Police/Redirect """
+class IP6PuntSetup(object):
+    """ Setup for 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()
-
+    def punt_setup(self):
         self.create_pg_interfaces(range(4))
 
         for i in self.pg_interfaces:
@@ -2200,23 +2190,34 @@
             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.