kgiusti commented on a change in pull request #662: DISPATCH-1547: add tests 
for router table updates
URL: https://github.com/apache/qpid-dispatch/pull/662#discussion_r367502095
 
 

 ##########
 File path: tests/system_tests_topology.py
 ##########
 @@ -592,5 +594,182 @@ def run(self):
         Container(self).run()
 
 
+class RouterFluxTest(TestCase):
+    """
+    Verify route table addresses are flushed properly when a remote router is
+    rebooted or the link is determined to be stale.
+    """
+
+    def _create_router(self, name,
+                       ra_interval=None,
+                       ra_stale=None,
+                       ra_flux=None,
+                       extra=None):
+
+        config = [
+            ('router', {'id': name,
+                        'mode': 'interior',
+                        # these are the default values from qdrouter.json
+                        'raIntervalSeconds': ra_interval or 30,
+                        'raIntervalFluxSeconds': ra_flux or 4,
+                        'remoteLsMaxAgeSeconds': ra_stale or 60}),
+            ('listener', {'role': 'normal',
+                          'port': self.tester.get_port()}),
+            ('address', {'prefix': 'closest',
+                         'distribution': 'closest'}),
+            ('address', {'prefix': 'multicast',
+                         'distribution': 'multicast'}),
+        ]
+
+        if extra:
+            config.extend(extra)
+        return self.tester.qdrouterd(name, Qdrouterd.Config(config),
+                                     wait=False, expect=None)
+
+    def _deploy_routers(self,
+                        ra_interval=None,
+                        ra_stale=None,
+                        ra_flux=None):
+        # configuration:
+        # linear 3 interior routers
+        #
+        #  +-------+    +-------+    +-------+
+        #  | INT.A |<==>| INT.B |<==>| INT.C |
+        #  +-------+    +-------+    +-------+
+        #
+        # INT.B has an inter-router listener, INT.A and INT.C connect in
+
+        i_r_port = self.tester.get_port()
+
+        INT_A = self._create_router('INT.A',
+                                    ra_interval,
+                                    ra_stale,
+                                    ra_flux,
+                                    extra=[('connector',
+                                            {'role': 'inter-router',
+                                             'name': 'connectorToB',
+                                             'port': i_r_port})])
+        INT_A.listener = INT_A.addresses[0]
+
+        INT_B = self._create_router('INT.B',
+                                    ra_interval,
+                                    ra_stale,
+                                    ra_flux,
+                                    extra=[('listener',
+                                            {'role': 'inter-router',
+                                             'port': i_r_port})])
+        INT_B.inter_router_port = i_r_port
+
+        INT_C = self._create_router('INT.C',
+                                    ra_interval,
+                                    ra_stale,
+                                    ra_flux,
+                                    extra=[('connector',
+                                            {'role': 'inter-router',
+                                             'name': 'connectorToB',
+                                             'port': i_r_port})])
+        #
+        # wait until router network is formed
+        #
+        INT_B.wait_router_connected('INT.A')
+        INT_B.wait_router_connected('INT.C')
+
+        #
+        # create mobile addresses on INT_A
+        #
+        consumers = [
+            AsyncTestReceiver(INT_A.listener,
+                              source='closest/on_A'),
+            AsyncTestReceiver(INT_A.listener,
+                              source='closest/on_A')]
+        #
+        # wait for addresses to show up on INT.C
+        #
+        INT_C.wait_address('closest/on_A')
+
+        return (INT_A, INT_B, INT_C, consumers)
+
+    def test_01_reboot_INT_A(self):
+        """
+        When a router comes online after a reboot its route table sequence will
+        be different from the last update it sent.  This should cause the local
+        router to flush all mobile addresses it learned from the remote router
+        before it rebooted.
+
+        Reboot INT.A and expect its mobile addresses are flushed on INT_C
+        """
+
+        # bump the remoteLsMaxAgeSeconds to longer than the test timeout so the
+        # test will timeout if the addresses are not removed before the link is
+        # considered stale
+        stale_timeout = int(TIMEOUT * 2)
+        INT_A, INT_B, INT_C, consumers = 
self._deploy_routers(ra_stale=stale_timeout)
+
+        # at this point all routers are running and the mobile addresses have
+        # propagated to INT_C.  Now reboot INT_A
+        INT_A.teardown()
+        time.sleep(1.0)
+        INT_A = self._create_router('INT.A',
+                                    ra_stale=stale_timeout,
+                                    extra=[('connector',
+                                            {'role': 'inter-router',
+                                             'name': 'connectorToB',
+                                             'port':
+                                             INT_B.inter_router_port})])
+        INT_A.wait_router_connected('INT.B')
+
+        # wait for INT_A mobile addresses to be removed from INT_C
+        mgmt = INT_C.management
+        a_type = 'org.apache.qpid.dispatch.router.address'
+        rsp = mgmt.query(a_type).get_dicts()
+        while any(map(lambda a: a['name'].find('closest/on_A') != -1, rsp)):
+            time.sleep(0.25)
+            rsp = mgmt.query(a_type).get_dicts()
+
+        # cleanup
+        for c in consumers:
 
 Review comment:
   done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to