コード例 #1
0
    def _create_router(self, router_id, router):
        # TODO(Carl) We need to support a router that is both HA and DVR.  The
        # patch that enables it will replace these lines.  See bug #1365473.
        if router.get('distributed') and router.get('ha'):
            raise n_exc.DvrHaRouterNotSupported(router_id=router_id)

        args = []
        kwargs = {
            'router_id': router_id,
            'router': router,
            'use_ipv6': self.use_ipv6,
            'agent_conf': self.conf,
            'interface_driver': self.driver,
        }

        if router.get('distributed'):
            kwargs['agent'] = self
            kwargs['host'] = self.host
            return dvr_router.DvrRouter(*args, **kwargs)

        if router.get('ha'):
            kwargs['state_change_callback'] = self.enqueue_state_change
            return ha_router.HaRouter(*args, **kwargs)

        return legacy_router.LegacyRouter(*args, **kwargs)
コード例 #2
0
ファイル: test_dvr_router.py プロジェクト: Tehsmash/neutron
 def _create_router(self, router=None, **kwargs):
     agent_conf = mock.Mock()
     self.router_id = _uuid()
     if not router:
         router = mock.MagicMock()
     return dvr_router.DvrRouter(mock.sentinel.agent, mock.sentinel.myhost,
                                 self.router_id, router, agent_conf,
                                 mock.sentinel.interface_driver, **kwargs)
コード例 #3
0
 def _create_router(self, router, **kwargs):
     agent_conf = mock.Mock()
     return dvr_router.DvrRouter(mock.sentinel.router_id, router,
                                 mock.sentinel.root_helper, agent_conf,
                                 mock.sentinel.interface_driver, **kwargs)