diff --git a/test/test_ip6.py b/test/test_ip6.py
index 92bb350..bff829b 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -2,14 +2,13 @@
 
 import unittest
 import socket
-from logging import *
 
 from framework import VppTestCase, VppTestRunner
-from vpp_sub_interface import VppSubInterface, VppDot1QSubint, VppDot1ADSubint
+from vpp_sub_interface import VppSubInterface, VppDot1QSubint
 
 from scapy.packet import Raw
 from scapy.layers.l2 import Ether, Dot1Q
-from scapy.layers.inet6 import ICMPv6ND_NS, IPv6, UDP
+from scapy.layers.inet6 import IPv6, UDP
 
 
 class TestIPv6(VppTestCase):
@@ -20,6 +19,26 @@
         super(TestIPv6, cls).setUpClass()
 
     def setUp(self):
+        """
+        Perform test setup before test case.
+
+        **Config:**
+            - create 3 pg interfaces
+                - untagged pg0 interface
+                - Dot1Q subinterface on pg1
+                - Dot1AD subinterface on pg2
+            - setup interfaces:
+                - put it into UP state
+                - set IPv6 addresses
+                - resolve neighbor address using NDP
+            - configure 200 fib entries
+
+        :ivar list interfaces: pg interfaces and subinterfaces.
+        :ivar dict flows: IPv4 packet flows in test.
+        :ivar list pg_if_packet_sizes: packet sizes in test.
+
+        *TODO:* Create AD sub interface
+        """
         super(TestIPv6, self).setUp()
 
         # create 3 pg interfaces
@@ -28,8 +47,9 @@
         # create 2 subinterfaces for p1 and pg2
         self.sub_interfaces = [
             VppDot1QSubint(self, self.pg1, 100),
-            VppDot1QSubint(self, self.pg2, 200)]
+            VppDot1QSubint(self, self.pg2, 200)
             # TODO: VppDot1ADSubint(self, self.pg2, 200, 300, 400)
+        ]
 
         # packet flows mapping pg0 -> pg1.sub, pg2.sub, etc.
         self.flows = dict()
@@ -50,16 +70,26 @@
             i.config_ip6()
             i.resolve_ndp()
 
-        # config 2M FIB enries
+        # config 2M FIB entries
         self.config_fib_entries(200)
 
     def tearDown(self):
+        """Run standard test teardown and log ``show ip6 neighbors``."""
         super(TestIPv6, self).tearDown()
         if not self.vpp_dead:
-            info(self.vapi.cli("show ip6 neighbors"))
+            self.logger.info(self.vapi.cli("show ip6 neighbors"))
             # info(self.vapi.cli("show ip6 fib"))  # many entries
 
     def config_fib_entries(self, count):
+        """For each interface add to the FIB table *count* routes to
+        "fd02::1/128" destination with interface's local address as next-hop
+        address.
+
+        :param int count: Number of FIB entries.
+
+        - *TODO:* check if the next-hop address shouldn't be remote address
+          instead of local address.
+        """
         n_int = len(self.interfaces)
         percent = 0
         counter = 0.0
@@ -70,13 +100,18 @@
             for j in range(count / n_int):
                 self.vapi.ip_add_del_route(
                     dest_addr, dest_addr_len, next_hop_address, is_ipv6=1)
-                counter = counter + 1
+                counter += 1
                 if counter / count * 100 > percent:
-                    info("Configure %d FIB entries .. %d%% done" %
+                    self.logger.info("Configure %d FIB entries .. %d%% done" %
                          (count, percent))
-                    percent = percent + 1
+                    percent += 1
 
     def create_stream(self, src_if, packet_sizes):
+        """Create input packet stream for defined interface.
+
+        :param VppInterface src_if: Interface to create packet stream for.
+        :param list packet_sizes: Required packet sizes.
+        """
         pkts = []
         for i in range(0, 257):
             dst_if = self.flows[src_if][i % 2]
@@ -96,7 +131,13 @@
         return pkts
 
     def verify_capture(self, dst_if, capture):
-        info("Verifying capture on interface %s" % dst_if.name)
+        """Verify captured input packet stream for defined interface.
+
+        :param VppInterface dst_if: Interface to verify captured packet stream
+                                    for.
+        :param list capture: Captured packet stream.
+        """
+        self.logger.info("Verifying capture on interface %s" % dst_if.name)
         last_info = dict()
         for i in self.interfaces:
             last_info[i.sw_if_index] = None
@@ -115,8 +156,8 @@
                 payload_info = self.payload_to_info(str(packet[Raw]))
                 packet_index = payload_info.index
                 self.assertEqual(payload_info.dst, dst_sw_if_index)
-                debug("Got packet on port %s: src=%u (id=%u)" %
-                      (dst_if.name, payload_info.src, packet_index))
+                self.logger.debug("Got packet on port %s: src=%u (id=%u)" %
+                                  (dst_if.name, payload_info.src, packet_index))
                 next_info = self.get_next_packet_info_for_interface2(
                     payload_info.src, dst_sw_if_index,
                     last_info[payload_info.src])
@@ -130,8 +171,8 @@
                 self.assertEqual(udp.sport, saved_packet[UDP].sport)
                 self.assertEqual(udp.dport, saved_packet[UDP].dport)
             except:
-                error("Unexpected or invalid packet:")
-                error(packet.show())
+                self.logger.error("Unexpected or invalid packet:")
+                self.logger.error(packet.show())
                 raise
         for i in self.interfaces:
             remaining_packet = self.get_next_packet_info_for_interface2(
@@ -142,7 +183,13 @@
                 (dst_if.name, i.name))
 
     def test_fib(self):
-        """ IPv6 FIB test """
+        """ IPv6 FIB test
+
+        Test scenario:
+            - Create IPv6 stream for pg0 interface
+            - Create IPv6 tagged streams for pg1's and pg2's subinterface.
+            - Send and verify received packets on each interface.
+        """
 
         pkts = self.create_stream(self.pg0, self.pg_if_packet_sizes)
         self.pg0.add_stream(pkts)
