BIND 10 trac2252, updated. d6d04321180adf453ecb64c28e03b2c43591e521 [2252] add a test scenario for Xfr request rejected in IPv4

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Mar 13 08:40:33 UTC 2013


The branch, trac2252 has been updated
       via  d6d04321180adf453ecb64c28e03b2c43591e521 (commit)
       via  be67ff2306c8aa98efd9ae3b017a2926dd3fd46e (commit)
       via  cb5eb7ddeb879f1658e446d06e9556aa075d4e3a (commit)
       via  d69fb646ed39dafe4277334a28b52d948e6348ae (commit)
       via  655179cfb251cd07a03469524e91c4ed81b57803 (commit)
       via  aca3456d32de52b95c0ec0986c041cc9ab63e132 (commit)
       via  55a49c67cdff76b0dca55d425ae977fb3feda9c2 (commit)
       via  85aef712019c4b0293e1726c705b6bfc749ad537 (commit)
       via  fcf8b9df5fb8511e9bd78f42bd797f2a8718c6e6 (commit)
       via  7fe200c92eb411c554a82fedb9b4126686961f0c (commit)
       via  0ef3b7adcd45bbd3127fc3aef69cf6798e69c807 (commit)
       via  936b3ffaaaca125fe6a87ea3ad3910aa2d45c3d5 (commit)
       via  695a3119423907a059435465f98669976a969f28 (commit)
       via  4d94e850cc95e491ce268c9782c0eae335e7f7ea (commit)
       via  2cfdda6be3038b9318c9f72da1b7c20488f2ae99 (commit)
       via  01b2a2fa9d86fbc5796626461b282581e46d2979 (commit)
       via  4de51f893dc92b863a9d3baa747153c2a011923c (commit)
       via  a1b3cfd353802b33b1ed51b51c9d98f6fe56d2bc (commit)
       via  75445a1c6e208d27ab8d85166ebd079be947f98b (commit)
      from  4b74e2550ba3030f666d03bf57f65f1d6d1a30f7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d6d04321180adf453ecb64c28e03b2c43591e521
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Wed Mar 13 10:56:10 2013 +0900

    [2252] add a test scenario for Xfr request rejected in IPv4

commit be67ff2306c8aa98efd9ae3b017a2926dd3fd46e
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Wed Mar 13 10:38:30 2013 +0900

    [2252] add a test scenario for handling incoming notify only in IPv4

commit cb5eb7ddeb879f1658e446d06e9556aa075d4e3a
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Tue Mar 12 20:17:37 2013 +0900

    [2252] reset numbers in the scenario tests

commit d69fb646ed39dafe4277334a28b52d948e6348ae
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Tue Mar 12 20:00:04 2013 +0900

    [2252] unify multiple similar checks of initial statistics into a step method

commit 655179cfb251cd07a03469524e91c4ed81b57803
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Tue Mar 12 20:14:45 2013 +0900

    [2252] reconsider expected values of counters for more specific values

commit aca3456d32de52b95c0ec0986c041cc9ab63e132
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Wed Mar 13 17:05:32 2013 +0900

    [2252] remove an obsoleted statistics step method

commit 55a49c67cdff76b0dca55d425ae977fb3feda9c2
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Tue Mar 12 19:14:26 2013 +0900

    [2252] unify repeating similar patterns
    
    follow the same way as queries.feature for checking the values of
    statistics counters

commit 85aef712019c4b0293e1726c705b6bfc749ad537
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Tue Mar 12 19:12:07 2013 +0900

    [2252] add evaluating a minimum or maxmimum value

commit fcf8b9df5fb8511e9bd78f42bd797f2a8718c6e6
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Tue Mar 12 14:33:18 2013 +0900

    [2252] replace assertGreaterEqual with assertAlmostEqual
    
    for more accurate check of latest_axfr_duration

commit 7fe200c92eb411c554a82fedb9b4126686961f0c
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Tue Mar 12 14:24:44 2013 +0900

    [2252] add tests for counters of XfrinConnection in IPv6 address

commit 0ef3b7adcd45bbd3127fc3aef69cf6798e69c807
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Tue Mar 12 13:56:43 2013 +0900

    [2252] test _get_ipver_str() by creating MockXfrinConnection object

commit 936b3ffaaaca125fe6a87ea3ad3910aa2d45c3d5
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Tue Mar 12 13:25:12 2013 +0900

    [2252] unify redundant assertion lines

commit 695a3119423907a059435465f98669976a969f28
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Tue Mar 12 20:31:29 2013 +0900

    [2252] typo fix

commit 4d94e850cc95e491ce268c9782c0eae335e7f7ea
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Wed Mar 13 14:14:10 2013 +0900

    [2252] remove poll-interval from stats config
    
    and query statistics data before waiting for the log messages instead
    of that

commit 2cfdda6be3038b9318c9f72da1b7c20488f2ae99
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Mon Mar 11 21:15:11 2013 +0900

    [2252] simplify complicated if-elif lines using a dictionary

commit 01b2a2fa9d86fbc5796626461b282581e46d2979
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Mon Mar 11 21:09:23 2013 +0900

    [2252] simplify complicated if-else lines (unrelated to #2252)

commit 4de51f893dc92b863a9d3baa747153c2a011923c
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Tue Mar 12 11:32:47 2013 +0900

    [2252] care for the socket family which is neither INET6 nor INET

commit a1b3cfd353802b33b1ed51b51c9d98f6fe56d2bc
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Mon Mar 11 20:26:47 2013 +0900

    [2252] rename the helper method name
    
    rename "get_ipver_str()" to "_get_ipver_str()" to protect an access
    from outside. This is for addressing the reviewer's comment.

commit 75445a1c6e208d27ab8d85166ebd079be947f98b
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Mon Mar 11 20:22:13 2013 +0900

    [2252] rename the item name and update descriptions
    
    rename the item name "time_to_xxxx" to "latest_xxxx_duration", and
    update descriptions of them. This is for addressing the reviewer's
    comment.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/xfrin/b10-xfrin.xml                        |    8 +-
 src/bin/xfrin/tests/xfrin_test.py                  |  178 ++++++---
 src/bin/xfrin/xfrin.py.in                          |   34 +-
 src/bin/xfrin/xfrin.spec                           |   16 +-
 src/lib/python/isc/statistics/counters.py          |    4 +-
 .../python/isc/statistics/tests/counters_test.py   |    4 +-
 .../isc/statistics/tests/testdata/test_spec3.spec  |   16 +-
 .../xfrin/retransfer_master.conf.orig              |    3 -
 ...er.conf.orig => retransfer_master_v4.conf.orig} |    7 +-
 .../xfrin/retransfer_slave_notify.conf             |    3 -
 ...notify.conf => retransfer_slave_notify_v4.conf} |    7 +-
 tests/lettuce/features/terrain/bind10_control.py   |  100 ++---
 tests/lettuce/features/terrain/terrain.py          |    2 +
 .../lettuce/features/xfrin_notify_handling.feature |  421 ++++++++++++--------
 14 files changed, 452 insertions(+), 351 deletions(-)
 copy tests/lettuce/configurations/xfrin/{retransfer_master.conf.orig => retransfer_master_v4.conf.orig} (91%)
 copy tests/lettuce/configurations/xfrin/{retransfer_slave_notify.conf => retransfer_slave_notify_v4.conf} (91%)

-----------------------------------------------------------------------
diff --git a/src/bin/xfrin/b10-xfrin.xml b/src/bin/xfrin/b10-xfrin.xml
index b29cbbd..ccec3f6 100644
--- a/src/bin/xfrin/b10-xfrin.xml
+++ b/src/bin/xfrin/b10-xfrin.xml
@@ -295,16 +295,16 @@ operation
                   </varlistentry>
 
                   <varlistentry>
-                    <term>time_to_ixfr</term>
+                    <term>latest_ixfr_duration</term>
                     <listitem><simpara>
-                      Elapsed time in second to do the last IXFR
+                      Duration of the latest IXFR
                     </simpara></listitem>
                   </varlistentry>
 
                   <varlistentry>
-                    <term>time_to_axfr</term>
+                    <term>latest_axfr_duration</term>
                     <listitem><simpara>
-                      Elapsed time in second to do the last AXFR
+                      Duration of the latest AXFR
                     </simpara></listitem>
                   </varlistentry>
 
diff --git a/src/bin/xfrin/tests/xfrin_test.py b/src/bin/xfrin/tests/xfrin_test.py
index c149cc2..8ae7554 100644
--- a/src/bin/xfrin/tests/xfrin_test.py
+++ b/src/bin/xfrin/tests/xfrin_test.py
@@ -711,13 +711,15 @@ class TestXfrinConnection(unittest.TestCase):
 
     '''
 
+    master_addrinfo = TEST_MASTER_IPV4_ADDRINFO
+
     def setUp(self):
         if os.path.exists(TEST_DB_FILE):
             os.remove(TEST_DB_FILE)
         self.sock_map = {}
         self.conn = MockXfrinConnection(self.sock_map, TEST_ZONE_NAME,
                                         TEST_RRCLASS, None, threading.Event(),
-                                        TEST_MASTER_IPV4_ADDRINFO)
+                                        self.master_addrinfo)
         self.conn.init_socket()
         self.soa_response_params = {
             'questions': [example_soa_question],
@@ -1068,33 +1070,32 @@ class TestAXFR(TestXfrinConnection):
                           self.conn._handle_xfrin_responses)
 
     def test_ipver_str(self):
-        orig_socket = self.conn.socket
-        class FakeSocket(): pass
-        self.conn.socket = FakeSocket()
-        self.conn.socket.family = socket.AF_INET
-        self.assertEqual(self.conn.get_ipver_str(), 'v4')
-        self.conn.socket.family = socket.AF_INET6
-        self.assertEqual(self.conn.get_ipver_str(), 'v6')
-        self.conn.socket.family = None
-        self.assertIsNone(self.conn.get_ipver_str())
-        self.conn.socket = orig_socket
+        addrs = (((socket.AF_INET, socket.SOCK_STREAM), 'v4'),
+                 ((socket.AF_INET6, socket.SOCK_STREAM), 'v6'),
+                 ((socket.AF_UNIX, socket.SOCK_STREAM), None))
+        for (info, ver) in addrs:
+            c = MockXfrinConnection({}, TEST_ZONE_NAME, RRClass.CH, None,
+                                    threading.Event(), info)
+            c.init_socket()
+            self.assertEqual(ver, c._get_ipver_str())
+            c.close()
 
     def test_soacheck(self):
         # we need to defer the creation until we know the QID, which is
         # determined in _check_soa_serial(), so we use response_generator.
         self.conn.response_generator = self._create_soa_response_data
         # check the statistics counters
-        self.assertRaises(isc.cc.data.DataNotFoundError,
-                          self.conn._counters.get, 'zones',
-                          TEST_ZONE_NAME_STR, 'soaoutv4')
-        self.assertRaises(isc.cc.data.DataNotFoundError,
-                          self.conn._counters.get, 'zones',
-                          TEST_ZONE_NAME_STR,'soaoutv6')
+        name2count = (('soaoutv4', 1),
+                      ('soaoutv6', 0))
+        for (n, c) in name2count:
+            self.assertRaises(isc.cc.data.DataNotFoundError,
+                              self.conn._counters.get, 'zones',
+                              TEST_ZONE_NAME_STR, n)
         self.assertEqual(self.conn._check_soa_serial(), XFRIN_OK)
-        self.assertEqual(1, self.conn._counters.get('zones', TEST_ZONE_NAME_STR,
-                                                    'soaoutv4'))
-        self.assertEqual(0, self.conn._counters.get('zones', TEST_ZONE_NAME_STR,
-                                                    'soaoutv6'))
+        for (n, c) in name2count:
+            self.assertEqual(c, self.conn._counters.get('zones',
+                                                        TEST_ZONE_NAME_STR,
+                                                        n))
 
     def test_soacheck_with_bad_response(self):
         self.conn.response_generator = self._create_broken_response_data
@@ -1461,25 +1462,16 @@ class TestAXFR(TestXfrinConnection):
     def test_do_xfrin(self):
         self.conn.response_generator = self._create_normal_response_data
         # check the statistics counters
-        self.assertRaises(isc.cc.data.DataNotFoundError,
-                          self.conn._counters.get, 'zones',
-                          TEST_ZONE_NAME_STR, 'axfrreqv4')
-        self.assertRaises(isc.cc.data.DataNotFoundError,
-                          self.conn._counters.get, 'zones',
-                          TEST_ZONE_NAME_STR, 'axfrreqv6')
-
-        self.assertRaises(isc.cc.data.DataNotFoundError,
-                          self.conn._counters.get, 'zones',
-                          TEST_ZONE_NAME_STR, 'ixfrreqv4')
-        self.assertRaises(isc.cc.data.DataNotFoundError,
-                          self.conn._counters.get, 'zones',
-                          TEST_ZONE_NAME_STR, 'ixfrreqv6')
-        self.assertRaises(isc.cc.data.DataNotFoundError,
-                          self.conn._counters.get, 'zones',
-                          TEST_ZONE_NAME_STR, 'xfrsuccess')
-        self.assertRaises(isc.cc.data.DataNotFoundError,
-                          self.conn._counters.get, 'zones',
-                          TEST_ZONE_NAME_STR, 'time_to_axfr')
+        name2count = (('axfrreqv4', 1),
+                      ('axfrreqv6', 0),
+                      ('ixfrreqv4', 0),
+                      ('ixfrreqv6', 0),
+                      ('xfrsuccess', 1),
+                      ('latest_axfr_duration', 0.0))
+        for (n, c) in name2count:
+            self.assertRaises(isc.cc.data.DataNotFoundError,
+                              self.conn._counters.get, 'zones',
+                              TEST_ZONE_NAME_STR, n)
         self.assertEqual(self.conn.do_xfrin(False), XFRIN_OK)
         self.assertFalse(self.conn._datasrc_client._journaling_enabled)
 
@@ -1490,30 +1482,19 @@ class TestAXFR(TestXfrinConnection):
         self.assertEqual(0, self.conn._transfer_stats.ixfr_addition_count)
         self.assertEqual(177, self.conn._transfer_stats.byte_count)
         self.assertGreater(self.conn._transfer_stats.get_running_time(), 0)
-        self.assertEqual(1,
-                         self.conn._counters.get('zones',
-                                                 TEST_ZONE_NAME_STR,
-                                                 'axfrreqv4'))
-        self.assertEqual(0,
-                         self.conn._counters.get('zones',
-                                                 TEST_ZONE_NAME_STR,
-                                                 'axfrreqv6'))
-        self.assertEqual(0,
-                         self.conn._counters.get('zones',
-                                                 TEST_ZONE_NAME_STR,
-                                                 'ixfrreqv4'))
-        self.assertEqual(0,
-                         self.conn._counters.get('zones',
-                                                 TEST_ZONE_NAME_STR,
-                                                 'ixfrreqv6'))
-        self.assertEqual(1,
-                         self.conn._counters.get('zones',
-                                                 TEST_ZONE_NAME_STR,
-                                                 'xfrsuccess'))
-        self.assertGreaterEqual(self.conn._counters.get('zones',
-                                                        TEST_ZONE_NAME_STR,
-                                                        'time_to_axfr'),
-                                0.0)
+        for (n, c) in name2count:
+            if n == 'latest_axfr_duration':
+                self.assertGreaterEqual(
+                    self.conn._counters.get('zones',
+                                            TEST_ZONE_NAME_STR,
+                                            n),
+                    c)
+            else:
+                self.assertEqual(
+                    c,
+                    self.conn._counters.get('zones',
+                                            TEST_ZONE_NAME_STR,
+                                            n))
 
     def test_do_xfrin_with_tsig(self):
         # use TSIG with a mock context.  we fake all verify results to
@@ -1682,6 +1663,75 @@ class TestAXFR(TestXfrinConnection):
         self.conn.response_generator = self._create_soa_response_data
         self.assertEqual(self.conn.do_xfrin(True), XFRIN_FAIL)
 
+class TestXfrinConnectionV6(TestXfrinConnection):
+    '''Test of TestXfrinConnection for IPv6'''
+    master_addrinfo = TEST_MASTER_IPV6_ADDRINFO
+
+class TestAXFRV6(TestXfrinConnectionV6):
+    def setUp(self):
+        super().setUp()
+        XfrinInitialSOA().set_xfrstate(self.conn, XfrinInitialSOA())
+
+    def tearDown(self):
+        # clear all statistics counters after each test
+        self.conn._counters.clear_all()
+        super().tearDown()
+
+    def test_soacheck(self):
+        # we need to defer the creation until we know the QID, which is
+        # determined in _check_soa_serial(), so we use response_generator.
+        self.conn.response_generator = self._create_soa_response_data
+        # check the statistics counters
+        name2count = (('soaoutv4', 0),
+                      ('soaoutv6', 1))
+        for (n, c) in name2count:
+            self.assertRaises(isc.cc.data.DataNotFoundError,
+                              self.conn._counters.get, 'zones',
+                              TEST_ZONE_NAME_STR, n)
+        self.assertEqual(self.conn._check_soa_serial(), XFRIN_OK)
+        for (n, c) in name2count:
+            self.assertEqual(c, self.conn._counters.get('zones',
+                                                        TEST_ZONE_NAME_STR,
+                                                        n))
+
+    def test_do_xfrin(self):
+        self.conn.response_generator = self._create_normal_response_data
+        # check the statistics counters
+        name2count = (('axfrreqv4', 0),
+                      ('axfrreqv6', 1),
+                      ('ixfrreqv4', 0),
+                      ('ixfrreqv6', 0),
+                      ('xfrsuccess', 1),
+                      ('latest_axfr_duration', 0.0))
+        for (n, c) in name2count:
+            self.assertRaises(isc.cc.data.DataNotFoundError,
+                              self.conn._counters.get, 'zones',
+                              TEST_ZONE_NAME_STR, n)
+        self.assertEqual(self.conn.do_xfrin(False), XFRIN_OK)
+        self.assertFalse(self.conn._datasrc_client._journaling_enabled)
+
+        self.assertEqual(2, self.conn._transfer_stats.message_count)
+        self.assertEqual(2, self.conn._transfer_stats.axfr_rr_count)
+        self.assertEqual(0, self.conn._transfer_stats.ixfr_changeset_count)
+        self.assertEqual(0, self.conn._transfer_stats.ixfr_deletion_count)
+        self.assertEqual(0, self.conn._transfer_stats.ixfr_addition_count)
+        self.assertEqual(177, self.conn._transfer_stats.byte_count)
+        self.assertGreater(self.conn._transfer_stats.get_running_time(), 0)
+        for (n, c) in name2count:
+            if n == 'latest_axfr_duration':
+                self.assertAlmostEqual(
+                    c,
+                    self.conn._counters.get('zones',
+                                            TEST_ZONE_NAME_STR,
+                                            n),
+                    delta=1.0)
+            else:
+                self.assertEqual(
+                    c,
+                    self.conn._counters.get('zones',
+                                            TEST_ZONE_NAME_STR,
+                                            n))
+
 class TestIXFRResponse(TestXfrinConnection):
     def setUp(self):
         # replace time.time with a steadily increasing fake one
diff --git a/src/bin/xfrin/xfrin.py.in b/src/bin/xfrin/xfrin.py.in
index 39e81c5..9dfcb5d 100755
--- a/src/bin/xfrin/xfrin.py.in
+++ b/src/bin/xfrin/xfrin.py.in
@@ -893,7 +893,7 @@ class XfrinConnection(asyncore.dispatcher):
         # All okay, return it
         return soa
 
-    def get_ipver_str(self):
+    def _get_ipver_str(self):
         """Returns a 'v4' or 'v6' string representing a IP version
         depending on the socket family"""
         if self.socket.family == socket.AF_INET:
@@ -912,8 +912,9 @@ class XfrinConnection(asyncore.dispatcher):
 
         self._send_query(RRType.SOA)
         # count soaoutv4 or soaoutv6 requests
-        self._counters.inc('zones', self._zone_name.to_text(),
-                           'soaout' + self.get_ipver_str())
+        if self._get_ipver_str():
+            self._counters.inc('zones', self._zone_name.to_text(),
+                               'soaout' + self._get_ipver_str())
         data_len = self._get_request_response(2)
         msg_len = socket.htons(struct.unpack('H', data_len)[0])
         soa_response = self._get_request_response(msg_len)
@@ -943,9 +944,7 @@ class XfrinConnection(asyncore.dispatcher):
         try:
             ret = XFRIN_OK
             self._request_type = request_type
-            # Right now RRType.[IA]XFR().to_text() is 'TYPExxx', so we need
-            # to hardcode here.
-            req_str = 'IXFR' if request_type == RRType.IXFR else 'AXFR'
+            req_str = request_type.to_text()
             if check_soa:
                 self._check_soa_serial()
                 self.close()
@@ -955,13 +954,14 @@ class XfrinConnection(asyncore.dispatcher):
 
             # start statistics timer
             self._counters.start_timer('zones', self._zone_name.to_text(),
-                                       'time_to_' + req_str.lower())
+                                       'latest_' + req_str.lower() + '_duration')
             logger.info(XFRIN_XFR_TRANSFER_STARTED, req_str, self.zone_str())
             self._send_query(self._request_type)
-            # count (A|X)IXFR requests for statistics
-            self._counters.inc('zones', self._zone_name.to_text(),
-                               req_str.lower() + 'req' +
-                               self.get_ipver_str())
+            # count AXFR/IXFR requests for statistics
+            if self._get_ipver_str():
+                self._counters.inc('zones', self._zone_name.to_text(),
+                                   req_str.lower() + 'req' +
+                                   self._get_ipver_str())
             self.__state = XfrinInitialSOA()
             self._handle_xfrin_responses()
             # Depending what data was found, we log different status reports
@@ -989,7 +989,7 @@ class XfrinConnection(asyncore.dispatcher):
                            )
             # stop statistics timer
             self._counters.stop_timer('zones', self._zone_name.to_text(),
-                                      'time_to_' + req_str.lower())
+                                      'latest_' + req_str.lower() + '_duration')
 
         except XfrinZoneUptodate:
             # Eventually we'll probably have to treat this case as a trigger
@@ -1030,14 +1030,10 @@ class XfrinConnection(asyncore.dispatcher):
             # (if not yet - possible in case of xfr-level exception) as soon
             # as possible
             self._diff = None
-            if ret == XFRIN_OK:
-                # count successful xfer requests
-                self._counters.inc('zones', self._zone_name.to_text(),
-                                   'xfrsuccess')
-            elif ret == XFRIN_FAIL:
-                # count failed xfer requests
+            counter_dict = {XFRIN_OK: 'xfrsuccess', XFRIN_FAIL: 'xfrfail'}
+            if ret in counter_dict:
                 self._counters.inc('zones', self._zone_name.to_text(),
-                                   'xfrfail')
+                                   counter_dict[ret])
 
         return ret
 
diff --git a/src/bin/xfrin/xfrin.spec b/src/bin/xfrin/xfrin.spec
index 547f072..00c519b 100644
--- a/src/bin/xfrin/xfrin.spec
+++ b/src/bin/xfrin/xfrin.spec
@@ -110,8 +110,8 @@
 	    "ixfrreqv6": 0,
 	    "xfrsuccess": 0,
 	    "xfrfail": 0,
-	    "time_to_ixfr": 0.0,
-	    "time_to_axfr": 0.0
+	    "latest_ixfr_duration": 0.0,
+	    "latest_axfr_duration": 0.0
           }
         },
         "item_title": "Zone names",
@@ -189,20 +189,20 @@
               "item_description": "Number of zone transfer requests failed"
             },
             {
-              "item_name": "time_to_ixfr",
+              "item_name": "latest_ixfr_duration",
               "item_type": "real",
               "item_optional": false,
               "item_default": 0.0,
-              "item_title": "Time to IXFR",
-              "item_description": "Elapsed time in seconds to do the last IXFR"
+              "item_title": "Latest IXFR duration",
+              "item_description": "Duration of the latest IXFR"
             },
             {
-              "item_name": "time_to_axfr",
+              "item_name": "latest_axfr_duration",
               "item_type": "real",
               "item_optional": false,
               "item_default": 0.0,
-              "item_title": "Time to AXFR",
-              "item_description": "Elapsed time in seconds to do the last AXFR"
+              "item_title": "Latest AXFR duration",
+              "item_description": "Duration of the latest AXFR"
             }
           ]
         }
diff --git a/src/lib/python/isc/statistics/counters.py b/src/lib/python/isc/statistics/counters.py
index 8138ab6..c8a1474 100644
--- a/src/lib/python/isc/statistics/counters.py
+++ b/src/lib/python/isc/statistics/counters.py
@@ -217,8 +217,8 @@ class Counters():
         zones/example.com./ixfrreqv6
         zones/example.com./xfrsuccess
         zones/example.com./xfrfail
-        zones/example.com./time_to_ixfr
-        zones/example.com./time_to_axfr
+        zones/example.com./latest_ixfr_duration
+        zones/example.com./latest_axfr_duration
         ixfr_running
         axfr_running
         socket/unixdomain/open
diff --git a/src/lib/python/isc/statistics/tests/counters_test.py b/src/lib/python/isc/statistics/tests/counters_test.py
index 395a959..6616ec3 100644
--- a/src/lib/python/isc/statistics/tests/counters_test.py
+++ b/src/lib/python/isc/statistics/tests/counters_test.py
@@ -197,7 +197,7 @@ class BaseTestCounters():
         # for per-zone counters
         for name in self.counters._zones_item_list:
             args = (self._perzone_prefix, TEST_ZONE_NAME_STR, name)
-            if name.find('time_to_') == 0:
+            if name.find('latest_') == 0 and name.endswith('_duration'):
                 self.counters.start_timer(*args)
                 self.counters.stop_timer(*args)
                 self.assertGreaterEqual(self.counters.get(*args), 0.0)
@@ -278,7 +278,7 @@ class BaseTestCounters():
         # setting all counters to zero
         for name in self.counters._zones_item_list:
             args = (self._perzone_prefix, TEST_ZONE_NAME_STR, name)
-            if name.find('time_to_') == 0:
+            if name.find('latest_') == 0 and name.endswith('_duration'):
                 zero = 0.0
             else:
                 zero = 0
diff --git a/src/lib/python/isc/statistics/tests/testdata/test_spec3.spec b/src/lib/python/isc/statistics/tests/testdata/test_spec3.spec
index c97a09a..da01c4f 100644
--- a/src/lib/python/isc/statistics/tests/testdata/test_spec3.spec
+++ b/src/lib/python/isc/statistics/tests/testdata/test_spec3.spec
@@ -19,8 +19,8 @@
 	    "ixfrreqv6": 0,
 	    "xfrsuccess": 0,
 	    "xfrfail": 0,
-	    "time_to_ixfr": 0.0,
-	    "time_to_axfr": 0.0
+	    "latest_ixfr_duration": 0.0,
+	    "latest_axfr_duration": 0.0
           }
         },
         "item_title": "Zone names",
@@ -98,20 +98,20 @@
               "item_description": "Number of zone transfer requests failed"
             },
             {
-              "item_name": "time_to_ixfr",
+              "item_name": "latest_ixfr_duration",
               "item_type": "real",
               "item_optional": false,
               "item_default": 0.0,
-              "item_title": "Time to IXFR",
-              "item_description": "Elapsed time in seconds to do the last IXFR"
+              "item_title": "Latest IXFR duration",
+              "item_description": "Duration of the latest IXFR"
             },
             {
-              "item_name": "time_to_axfr",
+              "item_name": "latest_axfr_duration",
               "item_type": "real",
               "item_optional": false,
               "item_default": 0.0,
-              "item_title": "Time to AXFR",
-              "item_description": "Elapsed time in seconds to do the last AXFR"
+              "item_title": "Latest AXFR duration",
+              "item_description": "Duration of the latest AXFR"
             }
           ]
         }
diff --git a/tests/lettuce/configurations/xfrin/retransfer_master.conf.orig b/tests/lettuce/configurations/xfrin/retransfer_master.conf.orig
index 1b2953d..d7ea9a5 100644
--- a/tests/lettuce/configurations/xfrin/retransfer_master.conf.orig
+++ b/tests/lettuce/configurations/xfrin/retransfer_master.conf.orig
@@ -33,9 +33,6 @@
             "port": 47806
         } ]
     },
-    "Stats": {
-        "poll-interval": 1
-    },
     "Init": {
         "components": {
             "b10-auth": { "kind": "needed", "special": "auth" },
diff --git a/tests/lettuce/configurations/xfrin/retransfer_master_v4.conf.orig b/tests/lettuce/configurations/xfrin/retransfer_master_v4.conf.orig
new file mode 100644
index 0000000..2a1a8b0
--- /dev/null
+++ b/tests/lettuce/configurations/xfrin/retransfer_master_v4.conf.orig
@@ -0,0 +1,45 @@
+{
+    "version": 3,
+    "Logging": {
+        "loggers": [ {
+            "debuglevel": 99,
+            "severity": "DEBUG",
+            "name": "*"
+        } ]
+    },
+    "Auth": {
+        "database_file": "data/example.org.sqlite3",
+        "listen_on": [ {
+            "address": "127.0.0.1",
+            "port": 47807
+        } ]
+    },
+    "data_sources": {
+        "classes": {
+            "IN": [{
+                "type": "sqlite3",
+                "params": {
+                    "database_file": "data/example.org.sqlite3"
+                }
+            }]
+        }
+    },
+    "Xfrout": {
+        "zone_config": [ {
+            "origin": "example.org"
+        } ],
+        "also_notify": [ {
+            "address": "127.0.0.1",
+            "port": 47806
+        } ]
+    },
+    "Init": {
+        "components": {
+            "b10-auth": { "kind": "needed", "special": "auth" },
+            "b10-xfrout": { "address": "Xfrout", "kind": "dispensable" },
+            "b10-zonemgr": { "address": "Zonemgr", "kind": "dispensable" },
+            "b10-stats": { "address": "Stats", "kind": "dispensable" },
+            "b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
+        }
+    }
+}
diff --git a/tests/lettuce/configurations/xfrin/retransfer_slave_notify.conf b/tests/lettuce/configurations/xfrin/retransfer_slave_notify.conf
index 1e7e9f4..3040b6c 100644
--- a/tests/lettuce/configurations/xfrin/retransfer_slave_notify.conf
+++ b/tests/lettuce/configurations/xfrin/retransfer_slave_notify.conf
@@ -37,9 +37,6 @@
             "class": "IN"
         } ]
     },
-    "Stats": {
-        "poll-interval": 1
-    },
     "Init": {
         "components": {
             "b10-auth": { "kind": "needed", "special": "auth" },
diff --git a/tests/lettuce/configurations/xfrin/retransfer_slave_notify_v4.conf b/tests/lettuce/configurations/xfrin/retransfer_slave_notify_v4.conf
new file mode 100644
index 0000000..6270bfd
--- /dev/null
+++ b/tests/lettuce/configurations/xfrin/retransfer_slave_notify_v4.conf
@@ -0,0 +1,49 @@
+{
+    "version": 3,
+    "Logging": {
+        "loggers": [ {
+            "debuglevel": 99,
+            "severity": "DEBUG",
+            "name": "*"
+        } ]
+    },
+    "Auth": {
+        "database_file": "data/xfrin-notify.sqlite3",
+        "listen_on": [ {
+            "address": "127.0.0.1",
+            "port": 47806
+        } ]
+    },
+    "data_sources": {
+        "classes": {
+            "IN": [{
+                "type": "sqlite3",
+                "params": {
+                    "database_file": "data/xfrin-notify.sqlite3"
+                }
+            }]
+        }
+    },
+    "Xfrin": {
+        "zones": [ {
+            "name": "example.org",
+            "master_addr": "127.0.0.1",
+            "master_port": 47807
+        } ]
+    },
+    "Zonemgr": {
+        "secondary_zones": [ {
+            "name": "example.org",
+            "class": "IN"
+        } ]
+    },
+    "Init": {
+        "components": {
+            "b10-auth": { "kind": "needed", "special": "auth" },
+            "b10-xfrin": { "address": "Xfrin", "kind": "dispensable" },
+            "b10-zonemgr": { "address": "Zonemgr", "kind": "dispensable" },
+            "b10-stats": { "address": "Stats", "kind": "dispensable" },
+            "b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
+        }
+    }
+}
diff --git a/tests/lettuce/features/terrain/bind10_control.py b/tests/lettuce/features/terrain/bind10_control.py
index bd5cf40..596a406 100644
--- a/tests/lettuce/features/terrain/bind10_control.py
+++ b/tests/lettuce/features/terrain/bind10_control.py
@@ -379,67 +379,6 @@ def query_statistics(step, statistics, name, cmdctl_port):
         % (port_str, name,\
                ' name=%s' % statistics if statistics else ''))
 
-def find_value(dictionary, key):
-    """A helper method. Recursively find a value corresponding to the
-    key of the dictionary and returns it. Returns None if the
-    dictionary is not dict type."""
-    if type(dictionary) is not dict:
-        return
-    if key in dictionary:
-        return dictionary[key]
-    else:
-        for v in dictionary.values():
-            return find_value(v, key)
-
- at step('the statistics counter (\S+)(?: in the category (\S+))?'+ \
-          '(?: for the zone (\S+))? should be' + \
-          '(?:( greater than| less than| between))? (\-?\d+)(?: and (\-?\d+))?')
-def check_statistics(step, counter, category, zone, gtltbt, number, upper):
-    """
-    check the output of bindctl for statistics of specified counter
-    and zone.
-    Parameters:
-    counter ('counter <counter>'): The counter name of statistics.
-    category ('category <category>', optional): The category of counter.
-    zone ('zone <zone>', optional): The zone name.
-    gtltbt (' greater than'|' less than'|' between', optional): greater than
-          <number> or less than <number> or between <number> and <upper>.
-    number ('<number>): The expect counter number. <number> is assumed
-          to be an unsigned integer.
-    upper ('<upper>, optional): The expect upper counter number when
-          using 'between'.
-    """
-    output = parse_bindctl_output_as_data_structure()
-    found = None
-    category_str = ""
-    zone_str = ""
-    depth = []
-    if category:
-        depth.insert(0, category)
-        category_str = " for category %s" % category
-    if zone:
-        depth.insert(0, zone)
-        zone_str = " for zone %s" % zone
-    for level in depth:
-        output = find_value(output, level)
-    found = find_value(output, counter)
-    assert found is not None, \
-        'Not found statistics counter %s%s%s' % \
-            (counter, category_str, zone_str)
-    msg = "Got %s, expected%s %s as counter %s%s" % \
-        (found, '' if gtltbt is None else gtltbt, number, counter, zone_str)
-    if gtltbt and 'between' in gtltbt and upper:
-        msg = "Got %s, expected%s %s and %s as counter %s%s" % \
-            (found, gtltbt, number, upper, counter, zone_str)
-        assert float(number) <= float(found) \
-            and float(found) <= float(upper), msg
-    elif gtltbt and 'greater' in gtltbt:
-        assert float(found) > float(number), msg
-    elif gtltbt and 'less' in gtltbt:
-        assert float(found) < float(number), msg
-    else:
-        assert float(found) == float(number), msg
-
 @step('statistics counters are 0 in category (\S+)( except for the' + \
           ' following items)?')
 def check_statistics_items(step, category, has_except_for):
@@ -470,15 +409,48 @@ def check_statistics_items(step, category, has_except_for):
         # fetch step tables in the scnario as hashes
         for item in step.hashes:
             name = category+'.'+item['item_name']
-            value = item['item_value']
             assert stats.has_key(name), \
                 'Statistics item %s was not found' % (name)
             found = stats[name]
-            assert int(found) == int(value), \
-                'Statistics item %s has unexpected value %s (expect %s)' % \
+            if 'item_value' in item and item['item_value']:
+                value = item['item_value']
+                assert int(found) == int(value), \
+                    'Statistics item %s has unexpected value %s (expect %s)' % \
+                    (name, found, value)
+            if 'min_value' in item and item['min_value']:
+                value = item['min_value']
+                assert float(value) <= float(found), \
+                    'Statistics item %s has unexpected value %s (expect %s or greater than)' % \
+                    (name, found, value)
+            if 'max_value' in item and item['max_value']:
+                value = item['max_value']
+                assert float(found) <= float(value), \
+                    'Statistics item %s has unexpected value %s (expect %s or less than)' % \
                     (name, found, value)
             del(stats[name])
     for name, found in stats.items():
         assert int(found) == 0, \
             'Statistics item %s has unexpected value %s (expect %s)' % \
                 (name, found, 0)
+
+ at step('check initial statistics for (Xfrin|Xfrout)')
+def check_init_statistics(step, module):
+    """
+    check the initial statistics for Xfrin or Xfrout.
+    Parameters:
+    module : Xfrin or Xfrout
+    """
+    query_str = 'When I query statistics %%s of bind10 module %s with cmdctl' % module
+    notcontain_str = 'last bindctl output should not contain "%s"'
+    check_str = 'The statistics counters are 0 in category .%s%%s' % module
+    if module == 'Xfrout':
+        query_str = query_str + ' port 47804'
+    step.given(query_str % 'zones')
+    step.given(notcontain_str % 'error')
+    step.given(notcontain_str % 'example.org.')
+    step.given(check_str % '.zones._SERVER_')
+    if module == 'Xfrout':
+        step.given(query_str % 'ixfr_running')
+        step.given(check_str)
+        step.given(query_str % 'axfr_running')
+        step.given(check_str)
diff --git a/tests/lettuce/features/terrain/terrain.py b/tests/lettuce/features/terrain/terrain.py
index ce7426b..22b1ec8 100644
--- a/tests/lettuce/features/terrain/terrain.py
+++ b/tests/lettuce/features/terrain/terrain.py
@@ -64,6 +64,8 @@ copylist = [
      "configurations/ddns/noddns.config"],
     ["configurations/xfrin/retransfer_master.conf.orig",
      "configurations/xfrin/retransfer_master.conf"],
+    ["configurations/xfrin/retransfer_master_v4.conf.orig",
+     "configurations/xfrin/retransfer_master_v4.conf"],
     ["configurations/xfrin/retransfer_master_nons.conf.orig",
      "configurations/xfrin/retransfer_master_nons.conf"],
     ["configurations/xfrin/retransfer_slave.conf.orig",
diff --git a/tests/lettuce/features/xfrin_notify_handling.feature b/tests/lettuce/features/xfrin_notify_handling.feature
index 9d1ec12..a411a6f 100644
--- a/tests/lettuce/features/xfrin_notify_handling.feature
+++ b/tests/lettuce/features/xfrin_notify_handling.feature
@@ -22,50 +22,112 @@ Feature: Xfrin incoming notify handling
     #
     # Test1 for Xfrout statistics
     #
-    # check initial statistics
+    check initial statistics for Xfrout
+    When I query statistics socket of bind10 module Xfrout with cmdctl port 47804
+    The statistics counters are 0 in category .Xfrout.socket.unixdomain except for the following items
+      | item_name | min_value | max_value |
+      | open      |         0 |         1 |
+
+    #
+    # Test2 for Xfrin statistics
+    #
+    check initial statistics for Xfrin
+    When I send bind10 with cmdctl port 47804 the command Xfrout notify example.org IN
+    Then wait for new master stderr message XFROUT_NOTIFY_COMMAND
+    Then wait for new bind10 stderr message AUTH_RECEIVED_NOTIFY
+    Then wait for new bind10 stderr message ZONEMGR_RECEIVE_NOTIFY
+    Then wait for new bind10 stderr message XFRIN_XFR_TRANSFER_STARTED
+    Then wait for new bind10 stderr message XFRIN_TRANSFER_SUCCESS not XFRIN_XFR_PROCESS_FAILURE
+    Then wait for new bind10 stderr message ZONEMGR_RECEIVE_XFRIN_SUCCESS
+    Then wait 5 times for new master stderr message NOTIFY_OUT_SENDING_NOTIFY
+    Then wait for new master stderr message NOTIFY_OUT_RETRY_EXCEEDED
+
+    A query for www.example.org to [::1]:47806 should have rcode NOERROR
+
+    #
+    # Test3 for Xfrout statistics
     #
+    # check statistics change
+    #
+
+    # wait until the last stats requesting is finished
     When I query statistics zones of bind10 module Xfrout with cmdctl port 47804
+    wait for new master stderr message STATS_SEND_STATISTICS_REQUEST
+    wait for new master stderr message XFROUT_RECEIVED_GETSTATS_COMMAND
     last bindctl output should not contain "error"
-    last bindctl output should not contain "example.org."
-    Then the statistics counter notifyoutv4 for the zone _SERVER_ should be 0
-    Then the statistics counter notifyoutv6 for the zone _SERVER_ should be 0
-    Then the statistics counter xfrrej for the zone _SERVER_ should be 0
-    Then the statistics counter xfrreqdone for the zone _SERVER_ should be 0
-
-    When I query statistics ixfr_running of bind10 module Xfrout with cmdctl port 47804
-    Then the statistics counter ixfr_running should be 0
 
-    When I query statistics axfr_running of bind10 module Xfrout with cmdctl port 47804
-    Then the statistics counter axfr_running should be 0
+    When I query statistics zones of bind10 module Xfrout with cmdctl port 47804
+    The statistics counters are 0 in category .Xfrout.zones except for the following items
+      | item_name                | item_value |
+      | _SERVER_.notifyoutv6     |          5 |
+      | _SERVER_.xfrreqdone      |          1 |
+      | example.org..notifyoutv6 |          5 |
+      | example.org..xfrreqdone  |          1 |
 
     When I query statistics socket of bind10 module Xfrout with cmdctl port 47804
-    Then the statistics counter open should be between 0 and 1
-    Then the statistics counter openfail should be 0
-    Then the statistics counter close should be 0
-    Then the statistics counter bindfail should be 0
-    Then the statistics counter acceptfail should be 0
-    Then the statistics counter accept should be 0
-    Then the statistics counter senderr should be 0
-    Then the statistics counter recverr should be 0
+    The statistics counters are 0 in category .Xfrout.socket.unixdomain except for the following items
+      | item_name | item_value |
+      | open      |          1 |
+      | accept    |          1 |
 
     #
-    # Test2 for Xfrin statistics
+    # Test4 for Xfrin statistics
     #
-    # check initial statistics
+    # check statistics change
     #
+
+    # wait until the last stats requesting is finished
     When I query statistics zones of bind10 module Xfrin with cmdctl
+    wait for new bind10 stderr message STATS_SEND_STATISTICS_REQUEST
+    wait for new bind10 stderr message XFRIN_RECEIVED_GETSTATS_COMMAND
     last bindctl output should not contain "error"
-    Then the statistics counter soaoutv4 for the zone _SERVER_ should be 0
-    Then the statistics counter soaoutv6 for the zone _SERVER_ should be 0
-    Then the statistics counter axfrreqv4 for the zone _SERVER_ should be 0
-    Then the statistics counter axfrreqv6 for the zone _SERVER_ should be 0
-    Then the statistics counter ixfrreqv4 for the zone _SERVER_ should be 0
-    Then the statistics counter ixfrreqv6 for the zone _SERVER_ should be 0
-    Then the statistics counter xfrsuccess for the zone _SERVER_ should be 0
-    Then the statistics counter xfrfail for the zone _SERVER_ should be 0
-    Then the statistics counter time_to_ixfr for the zone _SERVER_ should be 0.0
-    Then the statistics counter time_to_axfr for the zone _SERVER_ should be 0.0
 
+    When I query statistics zones of bind10 module Xfrin with cmdctl
+    The statistics counters are 0 in category .Xfrin.zones except for the following items
+      | item_name                         | item_value | min_value |
+      | _SERVER_.soaoutv6                 |          1 |           |
+      | _SERVER_.axfrreqv6                |          1 |           |
+      | _SERVER_.xfrsuccess               |          1 |           |
+      | _SERVER_.latest_axfr_duration     |            |       0.0 |
+      | example.org..soaoutv6             |          1 |           |
+      | example.org..axfrreqv6            |          1 |           |
+      | example.org..xfrsuccess           |          1 |           |
+      | example.org..latest_axfr_duration |            |       0.0 |
+
+    #
+    # Test for handling incoming notify only in IPv4
+    #
+    Scenario: Handle incoming notify (IPv4)
+    Given I have bind10 running with configuration xfrin/retransfer_master_v4.conf with cmdctl port 47804 as master
+    And wait for master stderr message BIND10_STARTED_CC
+    And wait for master stderr message CMDCTL_STARTED
+    And wait for master stderr message AUTH_SERVER_STARTED
+    And wait for master stderr message XFROUT_STARTED
+    And wait for master stderr message ZONEMGR_STARTED
+    And wait for master stderr message STATS_STARTING
+
+    And I have bind10 running with configuration xfrin/retransfer_slave_notify_v4.conf
+    And wait for bind10 stderr message BIND10_STARTED_CC
+    And wait for bind10 stderr message CMDCTL_STARTED
+    And wait for bind10 stderr message AUTH_SERVER_STARTED
+    And wait for bind10 stderr message XFRIN_STARTED
+    And wait for bind10 stderr message ZONEMGR_STARTED
+
+    A query for www.example.org to 127.0.0.1:47806 should have rcode NXDOMAIN
+
+    #
+    # Test1 for Xfrout statistics
+    #
+    check initial statistics for Xfrout
+    When I query statistics socket of bind10 module Xfrout with cmdctl port 47804
+    The statistics counters are 0 in category .Xfrout.socket.unixdomain except for the following items
+      | item_name | min_value | max_value |
+      | open      |         0 |         1 |
+
+    #
+    # Test2 for Xfrin statistics
+    #
+    check initial statistics for Xfrin
     When I send bind10 with cmdctl port 47804 the command Xfrout notify example.org IN
     Then wait for new master stderr message XFROUT_NOTIFY_COMMAND
     Then wait for new bind10 stderr message AUTH_RECEIVED_NOTIFY
@@ -76,7 +138,7 @@ Feature: Xfrin incoming notify handling
     Then wait 5 times for new master stderr message NOTIFY_OUT_SENDING_NOTIFY
     Then wait for new master stderr message NOTIFY_OUT_RETRY_EXCEEDED
 
-    A query for www.example.org to [::1]:47806 should have rcode NOERROR
+    A query for www.example.org to 127.0.0.1:47806 should have rcode NOERROR
 
     #
     # Test3 for Xfrout statistics
@@ -85,29 +147,24 @@ Feature: Xfrin incoming notify handling
     #
 
     # wait until the last stats requesting is finished
+    When I query statistics zones of bind10 module Xfrout with cmdctl port 47804
     wait for new master stderr message STATS_SEND_STATISTICS_REQUEST
     wait for new master stderr message XFROUT_RECEIVED_GETSTATS_COMMAND
+    last bindctl output should not contain "error"
 
     When I query statistics zones of bind10 module Xfrout with cmdctl port 47804
-    last bindctl output should not contain "error"
-    Then the statistics counter notifyoutv4 for the zone _SERVER_ should be 0
-    Then the statistics counter notifyoutv4 for the zone example.org. should be 0
-    Then the statistics counter notifyoutv6 for the zone _SERVER_ should be 5
-    Then the statistics counter notifyoutv6 for the zone example.org. should be 5
-    Then the statistics counter xfrrej for the zone _SERVER_ should be 0
-    Then the statistics counter xfrrej for the zone example.org. should be 0
-    Then the statistics counter xfrreqdone for the zone _SERVER_ should be 1
-    Then the statistics counter xfrreqdone for the zone example.org. should be 1
+    The statistics counters are 0 in category .Xfrout.zones except for the following items
+      | item_name                | item_value |
+      | _SERVER_.notifyoutv4     |          5 |
+      | _SERVER_.xfrreqdone      |          1 |
+      | example.org..notifyoutv4 |          5 |
+      | example.org..xfrreqdone  |          1 |
 
     When I query statistics socket of bind10 module Xfrout with cmdctl port 47804
-    Then the statistics counter open should be 1
-    Then the statistics counter openfail should be 0
-    Then the statistics counter close should be 0
-    Then the statistics counter bindfail should be 0
-    Then the statistics counter acceptfail should be 0
-    Then the statistics counter accept should be 1
-    Then the statistics counter senderr should be 0
-    Then the statistics counter recverr should be 0
+    The statistics counters are 0 in category .Xfrout.socket.unixdomain except for the following items
+      | item_name | item_value |
+      | open      |          1 |
+      | accept    |          1 |
 
     #
     # Test4 for Xfrin statistics
@@ -116,31 +173,22 @@ Feature: Xfrin incoming notify handling
     #
 
     # wait until the last stats requesting is finished
+    When I query statistics zones of bind10 module Xfrin with cmdctl
     wait for new bind10 stderr message STATS_SEND_STATISTICS_REQUEST
     wait for new bind10 stderr message XFRIN_RECEIVED_GETSTATS_COMMAND
+    last bindctl output should not contain "error"
 
     When I query statistics zones of bind10 module Xfrin with cmdctl
-    last bindctl output should not contain "error"
-    Then the statistics counter soaoutv4 for the zone _SERVER_ should be 0
-    Then the statistics counter soaoutv4 for the zone example.org. should be 0
-    Then the statistics counter soaoutv6 for the zone _SERVER_ should be 1
-    Then the statistics counter soaoutv6 for the zone example.org. should be 1
-    Then the statistics counter axfrreqv4 for the zone _SERVER_ should be 0
-    Then the statistics counter axfrreqv4 for the zone example.org. should be 0
-    Then the statistics counter axfrreqv6 for the zone _SERVER_ should be 1
-    Then the statistics counter axfrreqv6 for the zone example.org. should be 1
-    Then the statistics counter ixfrreqv4 for the zone _SERVER_ should be 0
-    Then the statistics counter ixfrreqv4 for the zone example.org. should be 0
-    Then the statistics counter ixfrreqv6 for the zone _SERVER_ should be 0
-    Then the statistics counter ixfrreqv6 for the zone example.org. should be 0
-    Then the statistics counter xfrsuccess for the zone _SERVER_ should be 1
-    Then the statistics counter xfrsuccess for the zone example.org. should be 1
-    Then the statistics counter xfrfail for the zone _SERVER_ should be 0
-    Then the statistics counter xfrfail for the zone example.org. should be 0
-    Then the statistics counter time_to_ixfr for the zone _SERVER_ should be 0.0
-    Then the statistics counter time_to_ixfr for the zone example.org. should be 0.0
-    Then the statistics counter time_to_axfr for the zone _SERVER_ should be greater than 0.0
-    Then the statistics counter time_to_axfr for the zone example.org. should be greater than 0.0
+    The statistics counters are 0 in category .Xfrin.zones except for the following items
+      | item_name                         | item_value | min_value |
+      | _SERVER_.soaoutv4                 |          1 |           |
+      | _SERVER_.axfrreqv4                |          1 |           |
+      | _SERVER_.xfrsuccess               |          1 |           |
+      | _SERVER_.latest_axfr_duration     |            |       0.0 |
+      | example.org..soaoutv4             |          1 |           |
+      | example.org..axfrreqv4            |          1 |           |
+      | example.org..xfrsuccess           |          1 |           |
+      | example.org..latest_axfr_duration |            |       0.0 |
 
     #
     # Test for Xfr request rejected
@@ -164,59 +212,130 @@ Feature: Xfrin incoming notify handling
     A query for www.example.org to [::1]:47806 should have rcode NXDOMAIN
 
     #
-    # Test5 for Xfrout statistics
+    # Test1 for Xfrout statistics
+    #
+    check initial statistics for Xfrout
+    When I query statistics socket of bind10 module Xfrout with cmdctl port 47804
+    The statistics counters are 0 in category .Xfrout.socket.unixdomain except for the following items
+      | item_name | min_value | max_value |
+      | open      |         0 |         1 |
+
+    #
+    # Test2 for Xfrin statistics
     #
-    # check initial statistics
+    check initial statistics for Xfrin
     #
+    # set transfer_acl rejection
+    # Local xfr requests from Xfrin module would be rejected here.
+    #
+    When I send bind10 the following commands with cmdctl port 47804
+    """
+    config set Xfrout/zone_config[0]/transfer_acl [{"action":  "REJECT", "from": "::1"}]
+    config commit
+    """
+    last bindctl output should not contain Error
+
+    When I send bind10 with cmdctl port 47804 the command Xfrout notify example.org IN
+    Then wait for new master stderr message XFROUT_NOTIFY_COMMAND
+    Then wait for new bind10 stderr message AUTH_RECEIVED_NOTIFY
+    Then wait for new bind10 stderr message ZONEMGR_RECEIVE_NOTIFY
+    Then wait for new bind10 stderr message XFRIN_XFR_TRANSFER_STARTED
+    Then wait for new bind10 stderr message XFRIN_XFR_TRANSFER_PROTOCOL_VIOLATION not XFRIN_XFR_TRANSFER_STARTED
+    Then wait for new bind10 stderr message ZONEMGR_RECEIVE_XFRIN_FAILED not ZONEMGR_RECEIVE_XFRIN_SUCCESS
+    Then wait 5 times for new master stderr message NOTIFY_OUT_SENDING_NOTIFY
+    Then wait for new master stderr message NOTIFY_OUT_RETRY_EXCEEDED
+
+    A query for www.example.org to [::1]:47806 should have rcode NXDOMAIN
+
+    #
+    # Test3 for Xfrout statistics
+    #
+    # check statistics change
+    #
+
+    # wait until the last stats requesting is finished
     When I query statistics zones of bind10 module Xfrout with cmdctl port 47804
+    wait for new master stderr message STATS_SEND_STATISTICS_REQUEST
+    wait for new master stderr message XFROUT_RECEIVED_GETSTATS_COMMAND
     last bindctl output should not contain "error"
-    last bindctl output should not contain "example.org."
-    Then the statistics counter notifyoutv4 for the zone _SERVER_ should be 0
-    Then the statistics counter notifyoutv6 for the zone _SERVER_ should be 0
-    Then the statistics counter xfrrej for the zone _SERVER_ should be 0
-    Then the statistics counter xfrreqdone for the zone _SERVER_ should be 0
 
-    When I query statistics ixfr_running of bind10 module Xfrout with cmdctl port 47804
-    Then the statistics counter ixfr_running should be 0
-
-    When I query statistics axfr_running of bind10 module Xfrout with cmdctl port 47804
-    Then the statistics counter axfr_running should be 0
+    When I query statistics zones of bind10 module Xfrout with cmdctl port 47804
+    The statistics counters are 0 in category .Xfrout.zones except for the following items
+      | item_name                | item_value | min_value |
+      | _SERVER_.notifyoutv6     |          5 |           |
+      | _SERVER_.xfrrej          |            |         1 |
+      | example.org..notifyoutv6 |          5 |           |
+      | example.org..xfrrej      |            |         1 |
 
     When I query statistics socket of bind10 module Xfrout with cmdctl port 47804
-    Then the statistics counter open should be between 0 and 1
-    Then the statistics counter openfail should be 0
-    Then the statistics counter close should be 0
-    Then the statistics counter bindfail should be 0
-    Then the statistics counter acceptfail should be 0
-    Then the statistics counter accept should be 0
-    Then the statistics counter senderr should be 0
-    Then the statistics counter recverr should be 0
+    The statistics counters are 0 in category .Xfrout.socket.unixdomain except for the following items
+      | item_name | item_value |
+      | open      |          1 |
+      | accept    |          1 |
 
     #
-    # Test6 for Xfrin statistics
+    # Test4 for Xfrin statistics
     #
-    # check initial statistics
+    # check statistics change
     #
+
+    # wait until the last stats requesting is finished
     When I query statistics zones of bind10 module Xfrin with cmdctl
+    wait for new bind10 stderr message STATS_SEND_STATISTICS_REQUEST
+    wait for new bind10 stderr message XFRIN_RECEIVED_GETSTATS_COMMAND
     last bindctl output should not contain "error"
-    Then the statistics counter soaoutv4 for the zone _SERVER_ should be 0
-    Then the statistics counter soaoutv6 for the zone _SERVER_ should be 0
-    Then the statistics counter axfrreqv4 for the zone _SERVER_ should be 0
-    Then the statistics counter axfrreqv6 for the zone _SERVER_ should be 0
-    Then the statistics counter ixfrreqv4 for the zone _SERVER_ should be 0
-    Then the statistics counter ixfrreqv6 for the zone _SERVER_ should be 0
-    Then the statistics counter xfrsuccess for the zone _SERVER_ should be 0
-    Then the statistics counter xfrfail for the zone _SERVER_ should be 0
-    Then the statistics counter time_to_ixfr for the zone _SERVER_ should be 0.0
-    Then the statistics counter time_to_axfr for the zone _SERVER_ should be 0.0
+
+    When I query statistics zones of bind10 module Xfrin with cmdctl
+    The statistics counters are 0 in category .Xfrin.zones except for the following items
+      | item_name              | min_value | max_value |
+      | _SERVER_.soaoutv6      |         1 |         3 |
+      | _SERVER_.axfrreqv6     |         1 |         3 |
+      | _SERVER_.xfrfail       |         1 |         3 |
+      | example.org..soaoutv6  |         1 |         3 |
+      | example.org..axfrreqv6 |         1 |         3 |
+      | example.org..xfrfail   |         1 |         3 |
+
+    #
+    # Test for Xfr request rejected in IPv4
+    #
+    Scenario: Handle incoming notify (XFR request rejected in IPv4)
+    Given I have bind10 running with configuration xfrin/retransfer_master_v4.conf with cmdctl port 47804 as master
+    And wait for master stderr message BIND10_STARTED_CC
+    And wait for master stderr message CMDCTL_STARTED
+    And wait for master stderr message AUTH_SERVER_STARTED
+    And wait for master stderr message XFROUT_STARTED
+    And wait for master stderr message ZONEMGR_STARTED
+    And wait for master stderr message STATS_STARTING
+
+    And I have bind10 running with configuration xfrin/retransfer_slave_notify_v4.conf
+    And wait for bind10 stderr message BIND10_STARTED_CC
+    And wait for bind10 stderr message CMDCTL_STARTED
+    And wait for bind10 stderr message AUTH_SERVER_STARTED
+    And wait for bind10 stderr message XFRIN_STARTED
+    And wait for bind10 stderr message ZONEMGR_STARTED
+
+    A query for www.example.org to 127.0.0.1:47806 should have rcode NXDOMAIN
 
     #
+    # Test1 for Xfrout statistics
+    #
+    check initial statistics for Xfrout
+    When I query statistics socket of bind10 module Xfrout with cmdctl port 47804
+    The statistics counters are 0 in category .Xfrout.socket.unixdomain except for the following items
+      | item_name | min_value | max_value |
+      | open      |         0 |         1 |
+
+    #
+    # Test2 for Xfrin statistics
+    #
+    check initial statistics for Xfrin
+    #
     # set transfer_acl rejection
     # Local xfr requests from Xfrin module would be rejected here.
     #
     When I send bind10 the following commands with cmdctl port 47804
     """
-    config set Xfrout/zone_config[0]/transfer_acl [{"action":  "REJECT", "from": "::1"}]
+    config set Xfrout/zone_config[0]/transfer_acl [{"action":  "REJECT", "from": "127.0.0.1"}]
     config commit
     """
     last bindctl output should not contain Error
@@ -231,73 +350,55 @@ Feature: Xfrin incoming notify handling
     Then wait 5 times for new master stderr message NOTIFY_OUT_SENDING_NOTIFY
     Then wait for new master stderr message NOTIFY_OUT_RETRY_EXCEEDED
 
-    A query for www.example.org to [::1]:47806 should have rcode NXDOMAIN
+    A query for www.example.org to 127.0.0.1:47806 should have rcode NXDOMAIN
 
     #
-    # Test7 for Xfrout statistics
+    # Test3 for Xfrout statistics
     #
     # check statistics change
     #
 
     # wait until the last stats requesting is finished
+    When I query statistics zones of bind10 module Xfrout with cmdctl port 47804
     wait for new master stderr message STATS_SEND_STATISTICS_REQUEST
     wait for new master stderr message XFROUT_RECEIVED_GETSTATS_COMMAND
+    last bindctl output should not contain "error"
 
     When I query statistics zones of bind10 module Xfrout with cmdctl port 47804
-    last bindctl output should not contain "error"
-    Then the statistics counter notifyoutv4 for the zone _SERVER_ should be 0
-    Then the statistics counter notifyoutv4 for the zone example.org. should be 0
-    Then the statistics counter notifyoutv6 for the zone _SERVER_ should be 5
-    Then the statistics counter notifyoutv6 for the zone example.org. should be 5
-    # The counts of rejection would be between 1 and 2. They are not
-    # fixed. It would depend on timing or the platform.
-    Then the statistics counter xfrrej for the zone _SERVER_ should be greater than 0
-    Then the statistics counter xfrrej for the zone example.org. should be greater than 0
-    Then the statistics counter xfrreqdone for the zone _SERVER_ should be 0
-    Then the statistics counter xfrreqdone for the zone example.org. should be 0
+    The statistics counters are 0 in category .Xfrout.zones except for the following items
+      | item_name                | item_value | min_value |
+      | _SERVER_.notifyoutv4     |          5 |           |
+      | _SERVER_.xfrrej          |            |         1 |
+      | example.org..notifyoutv4 |          5 |           |
+      | example.org..xfrrej      |            |         1 |
 
     When I query statistics socket of bind10 module Xfrout with cmdctl port 47804
-    Then the statistics counter open should be 1
-    Then the statistics counter openfail should be 0
-    Then the statistics counter close should be 0
-    Then the statistics counter bindfail should be 0
-    Then the statistics counter acceptfail should be 0
-    Then the statistics counter accept should be 1
-    Then the statistics counter senderr should be 0
-    Then the statistics counter recverr should be 0
+    The statistics counters are 0 in category .Xfrout.socket.unixdomain except for the following items
+      | item_name | item_value |
+      | open      |          1 |
+      | accept    |          1 |
 
     #
-    # Test8 for Xfrin statistics
+    # Test4 for Xfrin statistics
     #
     # check statistics change
     #
 
     # wait until the last stats requesting is finished
+    When I query statistics zones of bind10 module Xfrin with cmdctl
     wait for new bind10 stderr message STATS_SEND_STATISTICS_REQUEST
     wait for new bind10 stderr message XFRIN_RECEIVED_GETSTATS_COMMAND
+    last bindctl output should not contain "error"
 
     When I query statistics zones of bind10 module Xfrin with cmdctl
-    last bindctl output should not contain "error"
-    Then the statistics counter soaoutv4 for the zone _SERVER_ should be 0
-    Then the statistics counter soaoutv4 for the zone example.org. should be 0
-    Then the statistics counter soaoutv6 for the zone _SERVER_ should be greater than 0
-    Then the statistics counter soaoutv6 for the zone example.org. should be greater than 0
-    Then the statistics counter axfrreqv4 for the zone _SERVER_ should be 0
-    Then the statistics counter axfrreqv4 for the zone example.org. should be 0
-    Then the statistics counter axfrreqv6 for the zone _SERVER_ should be greater than 0
-    Then the statistics counter axfrreqv6 for the zone example.org. should be greater than 0
-    Then the statistics counter ixfrreqv4 for the zone _SERVER_ should be 0
-    Then the statistics counter ixfrreqv4 for the zone example.org. should be 0
-    Then the statistics counter ixfrreqv6 for the zone _SERVER_ should be 0
-    Then the statistics counter ixfrreqv6 for the zone example.org. should be 0
-    Then the statistics counter xfrsuccess for the zone _SERVER_ should be 0
-    Then the statistics counter xfrsuccess for the zone example.org. should be 0
-    Then the statistics counter xfrfail for the zone _SERVER_ should be greater than 0
-    Then the statistics counter xfrfail for the zone example.org. should be greater than 0
-    Then the statistics counter time_to_ixfr for the zone _SERVER_ should be 0.0
-    Then the statistics counter time_to_ixfr for the zone example.org. should be 0.0
-    Then the statistics counter time_to_axfr for the zone _SERVER_ should be 0.0
-    Then the statistics counter time_to_axfr for the zone example.org. should be 0.0
+    The statistics counters are 0 in category .Xfrin.zones except for the following items
+      | item_name              | min_value | max_value |
+      | _SERVER_.soaoutv4      |         1 |         3 |
+      | _SERVER_.axfrreqv4     |         1 |         3 |
+      | _SERVER_.xfrfail       |         1 |         3 |
+      | example.org..soaoutv4  |         1 |         3 |
+      | example.org..axfrreqv4 |         1 |         3 |
+      | example.org..xfrfail   |         1 |         3 |
 
     #
     # Test for unreachable slave
@@ -317,32 +418,24 @@ Feature: Xfrin incoming notify handling
     Then wait for new master stderr message NOTIFY_OUT_TIMEOUT
 
     #
-    # Test9 for Xfrout statistics
+    # Test1 for Xfrout statistics
     #
     # check statistics change
     #
 
     # wait until the last stats requesting is finished
+    When I query statistics zones of bind10 module Xfrout with cmdctl port 47804
     wait for new master stderr message STATS_SEND_STATISTICS_REQUEST
     wait for new master stderr message XFROUT_RECEIVED_GETSTATS_COMMAND
+    last bindctl output should not contain "error"
 
     When I query statistics zones of bind10 module Xfrout with cmdctl port 47804
-    last bindctl output should not contain "error"
-    Then the statistics counter notifyoutv4 for the zone _SERVER_ should be 0
-    Then the statistics counter notifyoutv4 for the zone example.org. should be 0
-    Then the statistics counter notifyoutv6 for the zone _SERVER_ should be greater than 0
-    Then the statistics counter notifyoutv6 for the zone example.org. should be greater than 0
-    Then the statistics counter xfrrej for the zone _SERVER_ should be 0
-    Then the statistics counter xfrrej for the zone example.org. should be 0
-    Then the statistics counter xfrreqdone for the zone _SERVER_ should be 0
-    Then the statistics counter xfrreqdone for the zone example.org. should be 0
+    The statistics counters are 0 in category .Xfrout.zones except for the following items
+      | item_name                | min_value | max_value |
+      | _SERVER_.notifyoutv6     |         1 |	       5 |
+      | example.org..notifyoutv6 |         1 |	       5 |
 
     When I query statistics socket of bind10 module Xfrout with cmdctl port 47804
-    Then the statistics counter open should be 1
-    Then the statistics counter openfail should be 0
-    Then the statistics counter close should be 0
-    Then the statistics counter bindfail should be 0
-    Then the statistics counter acceptfail should be 0
-    Then the statistics counter accept should be 0
-    Then the statistics counter senderr should be 0
-    Then the statistics counter recverr should be 0
+    The statistics counters are 0 in category .Xfrout.socket.unixdomain except for the following items
+      | item_name | item_value |
+      | open      |          1 |



More information about the bind10-changes mailing list