'agent_type': q_const.AGENT_TYPE_OVS,
'start_flag': True}
+ # Keep track of int_br's device count for use by _report_state()
+ self.int_br_device_count = 0
+
self.int_br = ovs_lib.OVSBridge(integ_br, self.root_helper)
self.setup_rpc()
self.setup_integration_br()
# Collect additional bridges to monitor
self.ancillary_brs = self.setup_ancillary_bridges(integ_br, tun_br)
- # Keep track of int_br's device count for use by _report_state()
- self.int_br_device_count = 0
-
# Security group agent supprot
self.sg_agent = OVSSecurityGroupAgent(self.context,
self.plugin_rpc,
self.root_helper)
def _report_state(self):
+ # How many devices are likely used by a VM
+ self.agent_state.get('configurations')['devices'] = (
+ self.int_br_device_count)
try:
- # How many devices are likely used by a VM
- self.agent_state.get('configurations')['devices'] = (
- self.int_br_device_count)
self.state_rpc.report_state(self.context,
self.agent_state)
self.agent_state.pop('start_flag', None)
# Avoid rpc initialization for unit tests
cfg.CONF.set_override('rpc_backend',
'neutron.openstack.common.rpc.impl_fake')
- cfg.CONF.set_override('report_interval', 0, 'AGENT')
kwargs = ovs_neutron_agent.create_agent_config_map(cfg.CONF)
+ class MockFixedIntervalLoopingCall(object):
+ def __init__(self, f):
+ self.f = f
+
+ def start(self, interval=0):
+ self.f()
+
with contextlib.nested(
mock.patch('neutron.plugins.openvswitch.agent.ovs_neutron_agent.'
'OVSNeutronAgent.setup_integration_br',
'get_local_port_mac',
return_value='00:00:00:00:00:01'),
mock.patch('neutron.agent.linux.utils.get_interface_mac',
- return_value='00:00:00:00:00:01')):
+ return_value='00:00:00:00:00:01'),
+ mock.patch('neutron.openstack.common.loopingcall.'
+ 'FixedIntervalLoopingCall',
+ new=MockFixedIntervalLoopingCall)):
self.agent = ovs_neutron_agent.OVSNeutronAgent(**kwargs)
self.agent.tun_br = mock.Mock()
self.agent.sg_agent = mock.Mock()