'Add tap interface.
If a VIF has been plugged into a network, this function will
add the corresponding tap device to the relevant bridge.'

def _add_tap_interface(self, network_id, network_type, physical_network, segmentation_id, tap_device_name, device_owner, mtu):

    if (not ip_lib.device_exists(tap_device_name)):
        LOG.debug('Tap    device:    %s    does    not    exist    on    this    host,    skipped', tap_device_name)
        return False
    bridge_name = self.get_existing_bridge_name(physical_network)
    if (not bridge_name):
        bridge_name = self.get_bridge_name(network_id)
    if (network_type == p_const.TYPE_LOCAL):
        self.ensure_local_bridge(network_id, bridge_name)
    elif (not self.ensure_physical_in_bridge(network_id, network_type, physical_network, segmentation_id)):
        return False
    if mtu:
        self._set_tap_mtu(tap_device_name, mtu)
    if (not device_owner.startswith(constants.DEVICE_OWNER_COMPUTE_PREFIX)):
        if (not bridge_lib.BridgeDevice.get_interface_bridge(tap_device_name)):
            data = {'tap_device_name': tap_device_name, 'bridge_name': bridge_name}
            LOG.debug('Adding    device    %(tap_device_name)s    to    bridge    %(bridge_name)s', data)
            if bridge_lib.BridgeDevice(bridge_name).addif(tap_device_name):
                return False
    else:
        data = {'tap_device_name': tap_device_name, 'device_owner': device_owner, 'bridge_name': bridge_name}
        LOG.debug('Skip    adding    device    %(tap_device_name)s    to    %(bridge_name)s.    It    is    owned    by    %(device_owner)s    and    thus    added    elsewhere.', data)
    return True
