def test_delete_network(self): rpcapi = agent_notify_api.AgentNotifierApi(topics.AGENT) self._test_mlnx_api(rpcapi, topics.get_topic_name(topics.AGENT, topics.NETWORK, topics.DELETE), 'network_delete', rpc_method='fanout_cast', network_id='fake_request_spec')
def _setup_rpc(self): # RPC support self.topic = topics.PLUGIN self.conn = rpc.create_connection(new=True) self.notifier = agent_notify_api.AgentNotifierApi(topics.AGENT) self.callbacks = rpc_callbacks.MlnxRpcCallbacks() self.dispatcher = self.callbacks.create_rpc_dispatcher() self.conn.create_consumer(self.topic, self.dispatcher, fanout=False) # Consume from all consumers in a thread self.conn.consume_in_thread()
def test_port_update(self): rpcapi = agent_notify_api.AgentNotifierApi(topics.AGENT) self._test_mlnx_api(rpcapi, topics.get_topic_name(topics.AGENT, topics.PORT, topics.UPDATE), 'port_update', rpc_method='fanout_cast', port='fake_port', network_type='vlan', physical_network='fake_net', vlan_id='fake_vlan_id')
def test_port_update_old_agent(self): cfg.CONF.set_override('rpc_support_old_agents', True, 'AGENT') rpcapi = agent_notify_api.AgentNotifierApi(topics.AGENT) self._test_mlnx_api(rpcapi, topics.get_topic_name(topics.AGENT, topics.PORT, topics.UPDATE), 'port_update', rpc_method='cast', fanout=True, port='fake_port', network_type='vlan', physical_network='fake_net', vlan_id='fake_vlan_id')
def test_port_update_ib(self): cfg.CONF.set_override('rpc_support_old_agents', False, 'AGENT') rpcapi = agent_notify_api.AgentNotifierApi(topics.AGENT) expected_msg = rpcapi.make_msg('port_update', port='fake_port', network_type='ib', physical_network='fake_net', segmentation_id='fake_vlan_id') self._test_mlnx_api(rpcapi, topics.get_topic_name(topics.AGENT, topics.PORT, topics.UPDATE), 'port_update', rpc_method='fanout_cast', expected_msg=expected_msg, port='fake_port', network_type='ib', physical_network='fake_net', vlan_id='fake_vlan_id')
def _setup_rpc(self): # RPC support self.service_topics = {svc_constants.CORE: topics.PLUGIN, svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN} self.conn = rpc.create_connection(new=True) self.callbacks = rpc_callbacks.MlnxRpcCallbacks() self.dispatcher = self.callbacks.create_rpc_dispatcher() for svc_topic in self.service_topics.values(): self.conn.create_consumer(svc_topic, self.dispatcher, fanout=False) # Consume from all consumers in a thread self.conn.consume_in_thread() self.notifier = agent_notify_api.AgentNotifierApi(topics.AGENT) self.agent_notifiers[q_const.AGENT_TYPE_DHCP] = ( dhcp_rpc_agent_api.DhcpAgentNotifyAPI() ) self.agent_notifiers[q_const.AGENT_TYPE_L3] = ( l3_rpc_agent_api.L3AgentNotify )
def _setup_rpc(self): # RPC support self.service_topics = {svc_constants.CORE: topics.PLUGIN, svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN} self.conn = n_rpc.create_connection(new=True) self.endpoints = [rpc_callbacks.MlnxRpcCallbacks(), securitygroups_rpc.SecurityGroupServerRpcCallback(), dhcp_rpc.DhcpRpcCallback(), l3_rpc.L3RpcCallback(), agents_db.AgentExtRpcCallback()] for svc_topic in self.service_topics.values(): self.conn.create_consumer(svc_topic, self.endpoints, fanout=False) # Consume from all consumers in threads self.conn.consume_in_threads() self.notifier = agent_notify_api.AgentNotifierApi(topics.AGENT) self.agent_notifiers[q_const.AGENT_TYPE_DHCP] = ( dhcp_rpc_agent_api.DhcpAgentNotifyAPI() ) self.agent_notifiers[q_const.AGENT_TYPE_L3] = ( l3_rpc_agent_api.L3AgentNotifyAPI() )