LOG.error(_LE("Expected port %s not found"), port.vif_id)
else:
LOG.debug("Unable to get config for port %s", port.vif_id)
- return
+ return False
vlan_mapping = {'net_uuid': net_uuid,
'network_type': network_type,
port_other_config.update(vlan_mapping)
self.int_br.set_db_attribute("Port", port.port_name, "other_config",
port_other_config)
+ return True
def _bind_devices(self, need_binding_ports):
devices_up = []
"and might not be able to transmit"), vif_port.vif_id)
if vif_port:
if admin_state_up:
- self.port_bound(vif_port, network_id, network_type,
- physical_network, segmentation_id,
- fixed_ips, device_owner, ovs_restarted)
+ port_needs_binding = self.port_bound(
+ vif_port, network_id, network_type,
+ physical_network, segmentation_id,
+ fixed_ips, device_owner, ovs_restarted)
else:
self.port_dead(vif_port)
port_needs_binding = False
with mock.patch.object(self.agent, 'int_br', autospec=True) as int_br:
int_br.db_get_val.return_value = db_get_val
int_br.set_db_attribute.return_value = True
- self.agent.port_bound(port, net_uuid, 'local', None, None,
- fixed_ips, "compute:None", False)
+ needs_binding = self.agent.port_bound(
+ port, net_uuid, 'local', None, None,
+ fixed_ips, "compute:None", False)
if db_get_val is None:
self.assertEqual(0, int_br.set_db_attribute.call_count)
+ self.assertFalse(needs_binding)
else:
vlan_mapping = {'net_uuid': net_uuid,
'network_type': 'local',
'physical_network': None}
int_br.set_db_attribute.assert_called_once_with(
"Port", mock.ANY, "other_config", vlan_mapping)
+ self.assertTrue(needs_binding)
def test_datapath_type_system(self):
# verify kernel datapath is default