コード例 #1
0
    def __init__(self, host, rpc_qn):
        self._my_host = host
        self._qn = '_'.join((rpc_qn, self._my_host))
        self._cfg = config.CiscoDFAConfig('neutron').cfg
        LOG.debug('Starting DFA Agent on %s', self._my_host)

        # List of task in the agent
        self.agent_task_list = []

        # This flag indicates the agent started for the first time.
        self._need_uplink_info = True

        # Initialize iptables driver. This will be used to update the ip
        # rules in iptables, after launching an instance.
        self._iptd = iptd.IptablesDriver(self._cfg)

        # Setup RPC client for sending heartbeat to controller
        self._url = self._cfg.dfa_rpc.transport_url
        self.setup_client_rpc()

        # Initialize VPD manager.
        br_int = 'br-int'
        br_ext = 'br-ethd'
        root_helper = self._cfg.sys.root_helper
        self._vdpm = vdpm.VdpMgr(br_int, br_ext, root_helper, self.clnt,
                                 thishost)
        self.pool = eventlet.GreenPool()
        self.setup_rpc()
コード例 #2
0
    def __init__(self, host, rpc_qn):
        self._host_name = host
        self._cfg = config.CiscoDFAConfig('neutron').cfg
        self._my_host = self._cfg.DEFAULT.host if self._cfg.DEFAULT.host else (
            utils.find_agent_host_id(host))
        self._qn = '_'.join((rpc_qn, self._my_host))
        LOG.debug('Starting DFA Agent on %s', self._my_host)

        # List of task in the agent
        self.agent_task_list = []

        # This flag indicates the agent started for the first time.
        self._need_uplink_info = True

        # Initialize iptables driver. This will be used to update the ip
        # rules in iptables, after launching an instance.

        if (self._cfg.dcnm.dcnm_dhcp.lower() == 'true'):
            self._iptd = iptd.IptablesDriver(self._cfg)
        else:
            self._iptd = None
            LOG.debug("Using native dhcp, iptable driver is not needed")

        # Setup RPC client for sending heartbeat to controller
        self._url = self._cfg.dfa_rpc.transport_url
        self.setup_client_rpc()

        # Initialize VPD manager.
        br_int = self._cfg.dfa_agent.integration_bridge
        br_ext = self._cfg.dfa_agent.external_dfa_bridge
        config_dict = {
            'integration_bridge': br_int,
            'external_bridge': br_ext,
            'host_id': self._my_host,
            'root_helper': self._cfg.sys.root_helper,
            'node_list': self._cfg.general.node,
            'node_uplink_list': self._cfg.general.node_uplink
        }

        self._vdpm = vdpm.VdpMgr(config_dict, self.clnt, self._host_name)
        self.pool = eventlet.GreenPool()
        self.setup_rpc()
コード例 #3
0
 def _test_dfa_mgr_init(self):
     '''Test routine for init '''
     with mock.patch('networking_cisco.apps.saf.common.utils.'
                     'EventProcessingThread') as event_fn,\
             mock.patch('networking_cisco.apps.saf.common.'
                        'utils.PeriodicTask') as period_fn:
         event_obj = event_fn.return_value
         period_obj = period_fn.return_value
         parent = mock.MagicMock()
         parent.attach_mock(event_obj.start, 'start')
         parent.attach_mock(period_obj.run, 'run')
         self.dfa_vdp_mgr = dfa_vdp_mgr.VdpMgr(self.config_dict,
                                               self.rpc_client, self.host)
     event_fn.assert_called_with("VDP_Mgr", self.dfa_vdp_mgr,
                                 'process_queue')
     period_fn.assert_any_call(constants.ERR_PROC_INTERVAL,
                               self.dfa_vdp_mgr.process_err_queue)
     period_fn.assert_any_call(constants.UPLINK_DET_INTERVAL,
                               self.dfa_vdp_mgr.vdp_uplink_proc_top)
     expected_calls = [mock.call.start(), mock.call.run(), mock.call.run()]
     parent.assert_has_calls(expected_calls)