'Update subports segmentation details if INHERIT is requested.'

def _prepare_subports(self, context):

    port_ids = {s['port_id']: i for (i, s) in enumerate(self.subports) if (s.get('segmentation_type') == constants.INHERIT)}
    core_plugin = directory.get_plugin()
    if (not port_ids):
        return
    elif (not n_utils.is_extension_supported(core_plugin, provider.ALIAS)):
        msg = (_('Cannot    accept    segmentation    type    %s') % constants.INHERIT)
        raise n_exc.InvalidInput(error_message=msg)
    ports = core_plugin.get_ports(context, filters={'id': port_ids})
    network_port_map = {x['network_id']: {'port_id': x['id']} for x in ports}
    networks = core_plugin.get_networks(context.elevated(), filters={'id': network_port_map})
    for net in networks:
        port = network_port_map[net['id']]
        port.update({'segmentation_id': net[provider.SEGMENTATION_ID], 'segmentation_type': net[provider.NETWORK_TYPE]})
        self.subports[port_ids[port['port_id']]] = port
