'Iterate through the internal links map and create a
frozenset of ``Link`` instances in each application, mapping
the link name and alias to the ports of the target linked
application.
:returns: ``None``'

def _link_applications(self):

    for (application_name, link) in self._application_links.items():
        app_links = []
        for link_definition in link:
            target_application_ports = self._applications[link_definition[u'target_application']].ports
            for target_ports_object in target_application_ports:
                local_port = target_ports_object.internal_port
                remote_port = target_ports_object.external_port
                try:
                    app_links.append(Link(local_port=local_port, remote_port=remote_port, alias=link_definition[u'alias']))
                except InvariantException as e:
                    raise ConfigurationError(u"Application    '{application}'    has    a    config    error:    {errors}".format(application=application_name, errors=u'    '.join(e.invariant_errors)))
        application = self._applications[application_name]
        self._applications[application_name] = application.set(u'links', app_links)
